List of QNAP basic commands

Don't miss a thing. Post your questions and discussion about other uncategorized NAS features here.
ccc
Know my way around
Posts: 136
Joined: Fri May 21, 2010 6:13 am

List of QNAP basic commands

Post by ccc »

hi

I'm looking for a list of QNAP basic commands, using via putty, for example restart ssh, samba, force shutdown etc.
Last edited by ccc on Wed Oct 23, 2013 4:23 am, edited 3 times in total.
User avatar
pwilson
Guru
Posts: 22533
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: QNAP basic commands

Post by pwilson »

ccc wrote:hi

I'm looking for all QNAP basic commands via putty, for example restart ssh, samba, force shutdown etc.
Restart SSH:

Code: Select all

/etc/rcS.d/S85login restart
Restart Samba:

Code: Select all

/etc/rcS.d/S62smb restart
Do shutdown through the WebUI.

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.
ccc
Know my way around
Posts: 136
Joined: Fri May 21, 2010 6:13 am

Re: QNAP basic commands

Post by ccc »

Thx, but I need all other commands as well, like on competition product Synology:

Basic commands to get around the Synology Box using the CLI
Last edited by ccc on Wed Oct 23, 2013 4:17 am, edited 3 times in total.
User avatar
rtruell
Getting the hang of things
Posts: 62
Joined: Sun Jul 08, 2012 11:36 am
Location: Edmonton, Alberta, Canada

Re: QNAP basic commands

Post by rtruell »

ccc wrote:hi I'm looking for all QNAP basic commands via putty, for example restart ssh, samba, force shutdown etc.
ccc wrote:Thx, but I need all other commands as wll, like on Synology:

Basic commands to get around the Synology Box using the CLI
There are really no "QNAP basic commands". For that matter, there are really no "Synology basic commands" either. The Synology and QNAP boxes run (slightly different) versions of the Linux operating system; thus, most of the CLI commands that work on any Linux distro will also work on boxes from either QNAP or Synology. The list of "Synology" commands in the link you provided will, for the most part, work as-is on QNAP boxes. Ones that *won't* work as they are in that list are the commands in the "Restart Services" section; on the QNAP boxes, the service startup scripts are in the '/etc/rcS.d' directory (as Patrick pointed out), they have different sequence numbers and, in some cases, the programs aren't available (Apache, for instance).
Rick Truell
Edmonton, Alberta, Canada

NAS: TS-119P II, F/W: QTS 4.0.2 Build 20130726, Drive: WD 2TB RE4 || TS-419P II, F/W: QTS 4.1.1 Build 20141003, Drives: 4 * WD 3TB Red
Computers: || Mac mini running Yosemite (10.10.4)
PVR: i5 & Core 2 Duo, both running MythBuntu. Tuners: Hauppauge PVR-150, 2 * HVR-1600 and 2 * HVR-2250
ccc
Know my way around
Posts: 136
Joined: Fri May 21, 2010 6:13 am

Re: QNAP basic commands

Post by ccc »

I know already that QNAP and Synology have different commands.
If I can use Synology commands on QNAP, I will not ask in this forum.
I was searching just for a list with basic commands for Qnap boxes.
User avatar
schumaku
Guru
Posts: 43578
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: QNAP basic commands

Post by schumaku »

ccc wrote:If I can use Synology commands on QNAP, I will not ask in this forum.
I don't think so ... Large majority listed there is not Synology - it's plain standard basic embedded (Busybox based) Linux - except what holds the Syno specific path prefix there.
ccc wrote:I was searching just for a list with basic commands for Qnap boxes.
To achieve what exactly?
AlbertH
Starting out
Posts: 35
Joined: Thu Aug 20, 2009 11:14 pm

Re: List of QNAP basic commands

Post by AlbertH »

Let's revive this old thread, because there *are* (many) Qnap-specific commands, and a list would be nice.

Currently, I'm trying to find a command which would show the Qnap firmware version. While searching, I found this:

Code: Select all

[~] # /sbin/getsysinfo
cputmp : get CPU temperature
systmp : get system temperature
sysfan [fan no] : get system fan speed
sysfannum : get total system fan number
hdnum : get total system SATA disk number
hdtmp [disk no] : get SATA disk temperature
hdstatus [disk no] : get SATA disk status
hdmodel [disk no] : get SATA disk model
hdcapacity [disk no] : get SATA disk capacity
hdsmart [disk no] : get SATA disk SMART summary
model : get system model name
sysvolnum : get system volume number
vol_desc [volume no] : get volume description
vol_fs [volume no] : get volume file system
vol_totalsize [volume no] : get volume total size
vol_freesize [volume no] : get volume free size
vol_status [volume no] : get volume status

Code: Select all

[~] # /sbin/getsysinfo model
TS-1079 Pro

[~] # /sbin/get_hwver
1.0

[~] # /sbin/get_hwsn
Q123I10...
Also, most Samba commands are not in the PATH, but in /usr/local/samba/bin/ or /usr/local/samba/sbin/

But I still find no way to show the QOS firmware version and build number.
AlastairStevenson
Experience counts
Posts: 2415
Joined: Wed Jan 08, 2014 10:34 pm

Re: List of QNAP basic commands

Post by AlastairStevenson »

Code: Select all

[~] # uname -a
Linux kinkellmain 3.10.20-al-2.5.3_sa #2 SMP Fri Jan 1 06:29:56 CST 2016 armv7l unknown
[~] #
This is the standard Linux command for listing the system.
TS-431+ for storage and media and a bunch of IP cams under Surveillance Station. TVS-473 as files backup and QVR Pro.
User avatar
dolbyman
Guru
Posts: 35273
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: List of QNAP basic commands

Post by dolbyman »

But I still find no way to show the QOS firmware version and build number.
getcfg system version
getcfg system 'Build Number'

(from pwilsons script)
AlbertH
Starting out
Posts: 35
Joined: Thu Aug 20, 2009 11:14 pm

Re: List of QNAP basic commands

Post by AlbertH »

Thanks. That's it. In the meantime, I had found the info in /etc/config/uLinux.conf, but extracting it with sed is horrible.

I had tried getcfg --help, but that is not very informative. Is there a documentation on getcfg somewhere?
User avatar
Toxic17
Ask me anything
Posts: 6477
Joined: Tue Jan 25, 2011 11:41 pm
Location: Planet Earth
Contact:

Re: List of QNAP basic commands

Post by Toxic17 »

AlbertH wrote:Let's revive this old thread, because there *are* (many) Qnap-specific commands, and a list would be nice.

Currently, I'm trying to find a command which would show the Qnap firmware version. While searching, I found this:
the late great Patrick Wilson, had a better script to grab everything you needed.

Code: Select all

#!/bin/sh
rm -f /tmp/nasreport
touch /tmp/nasreport
chmod +x /tmp/nasreport
cat <<EOF >>/tmp/nasreport
#!/bin/sh
#
# NAS Report by Patrick Wilson
# see: http://forum.qnap.com/viewtopic.php?f=185&t=82260#p366188
#
# 
echo "[code]*********************"
echo "** QNAP NAS Report **"
echo "*********************"
echo " "
echo "NAS Model:      \$(getsysinfo model)"
echo "Firmware:       \$(getcfg system version) Build \$(getcfg system 'Build Number')"
echo "System Name:    \$(/bin/hostname)"
echo "Workgroup:      \$(getcfg system workgroup)"
echo "Base Directory: \$(dirname \$(getcfg -f /etc/config/smb.conf Public path))"
echo "NAS IP address: \$(ifconfig \$(getcfg network 'Default GW Device') | grep addr: | awk '{ print \$2 }' | cut -d: -f2)"
echo " " 
echo "Default Gateway Device: \$(getcfg network 'Default GW Device')" 
echo " "
ifconfig \$(getcfg network 'Default GW Device') | grep -v HWaddr
echo " "
echo -n "DNS Nameserver(s):" 
cat /etc/resolv.conf | grep nameserver | cut -d' ' -f2
echo " "
echo " "
echo "HDD Information:"
echo " "
alpha='abcdefghijklmnopqrstuvwxyz'
drives=\$(getcfg Storage 'Disk Drive Number')
for ((i=1;i<=drives;++i)) ; do
   echo -n "HDD\$i -"
   if [ ! -b /dev/sd\${alpha:\$i-1:1} ] ; then
      echo "Drive absent"
   else
      hdparm -i /dev/sd\${alpha:\$i-1:1} | grep "Model"
      echo " "
      parted /dev/sd\${alpha:\$i-1:1} print
      echo " "
      /sbin/get_hd_smartinfo -d \$i
      echo " "
   fi
done
echo "Volume Status"
echo " "
mdadm -D /dev/md0 /dev/md1 2>/dev/null
echo " "
cat /proc/mdstat
echo " "
echo "Disk Space:"
echo " "
df -h | grep -v qpkg
echo " "
echo "Mount Status:" 
echo " "
mount | grep -v qpkg
echo " "
#echo "Contents of \$(dirname \$(getcfg -f /etc/config/smb.conf Public path)):"
#echo " "
#ls -lF \$(dirname \$(getcfg -f /etc/config/smb.conf Public path))/
echo " "
echo "Windows Shares:" 
echo " "
for i in \$(grep \] /etc/config/smb.conf | sed 's/^\[//g' | sed 's/\]//g' | grep -v global) ;do 
   echo -n "\$i:"
   testparm -s -l --section-name="\$i" --parameter-name=path 2>/dev/null 
done
#echo " "
#echo "QNAP Media Scanner / Transcoder processes running: "
#echo " " 
#/bin/ps | grep medialibrary | grep -v grep
#echo " " 
#echo -n "MediaLibrary Configuration file: " 
#ls -alF /etc/config/medialibrary.conf
#echo " " 
#echo "/etc/config/medialibrary.conf:"
#cat /etc/config/medialibrary.conf
echo " "
echo "iTunes Music Store: \$(getcfg -f /etc/config/mt-daapd.conf general mp3_dir)"
echo " "
echo "Memory Information:" 
echo " "
free | grep -v cache:
echo " "
echo "NASReport completed on \$(date +'%Y-%m-%d %T') (\$0) 
"
echo " "
EOF
sleep 2
clear
/tmp/nasreport
#done[/code]

Just Select all and paste into an SSH window. :)
Regards Simon

Qnap Downloads
MyQNap.Org Repository
Submit a ticket • QNAP Helpdesk
QNAP Tutorials, User Manuals, FAQs, Downloads, Wiki
When you ask a question, please include the following


NAS: TS-673A QuTS hero h5.1.2.2534 • TS-121 4.3.3.2420 • APC Back-UPS ES 700G
Network: VM Hub3: 500/50 • UniFi UDM Pro: 3.2.9 • UniFi Network Controller: 8.0.28
USW-Aggregation: 6.6.61 • US-16-150W: 6.6.61 • 2x USW Mini Flex 2.0.0 • UniFi AC Pro 6.6.62 • UniFi U6-LR 6.6.62
UniFi Protect: 2.11.21/8TB Skyhawk AI • 3x G3 Instants: 4.69.55 • UniFi G3 Flex: 4.69.55 • UniFi G5 Flex: 4.69.55
freephile
First post
Posts: 1
Joined: Wed Dec 02, 2015 11:51 am

Re: List of QNAP basic commands

Post by freephile »

You can also do the following in your shell

show the commands provided by BusyBox

Code: Select all

 busybox 
show the other utilities which are not symlinks to BusyBox

Code: Select all

 ls -al /mnt/HDA_ROOT/usr/bin |grep -v busybox 
show the "secure" bin commands

Code: Select all

 ls -al /mnt/HDA_ROOT/usr/sbin
sethr
Starting out
Posts: 17
Joined: Sun Jan 08, 2017 2:32 am

Re: QNAP basic commands

Post by sethr »

pwilson wrote:
ccc wrote:hi

I'm looking for all QNAP basic commands via putty, for example restart ssh, samba, force shutdown etc.
Restart SSH:

Code: Select all

/etc/rcS.d/S85login restart
Restart Samba:

Code: Select all

/etc/rcS.d/S62smb restart
Do shutdown through the WebUI.
NOT on a 431+. It should, but it only reboots and starts a resynch for hours.
431+, 6TB HGST drives, RAID 10, UPS and USB 3 external on two ports, dual ALB 1Gb network. QTS 4.3Beta
fps_user
New here
Posts: 4
Joined: Tue Jun 20, 2017 8:28 pm

Re: List of QNAP basic commands

Post by fps_user »

@wise-asses
What's so difficult just to post basic linux commands to help?

http://www.qnap-singapore.com/guides/qn ... -commands/
AlbertH
Starting out
Posts: 35
Joined: Thu Aug 20, 2009 11:14 pm

Re: List of QNAP basic commands

Post by AlbertH »

@fps_user : thanks for the link, but this only lists a few generic linux/unix commands, which are widely documented everywhere. The question was about Qnap-specific commands for which there seems to be no serious documentation anywhere, only bits and pieces here and there.
Locked

Return to “Miscellaneous”