OS4k Linux Commands PDF
OS4k Linux Commands PDF
OS4k Linux Commands PDF
Contents:
0. Scope & Help
I. Cron
II. DSCXL2
III. Directory
IV. Edit Files
V. Files
VI. Hard Disk
VII. Informix
VIII.Network
IX. Search
X. Shutdown / Restart
XI. SW - Apps
XII. Time
XIII.Troubleshoot
Changes:
1.Published=Dec. 31, 2012 = Happy New Year! / 2.Rev.= Feb.2013 = minor changes. / 3.Rev.=Apr.2013= v6r2 tethereal ( add wireshark package )
4.Rev.=July23 = rewrote TIME section for Robert Reed. / 5.Rev.= Dec.2 = Unify + egrep = find a word inside a file
6.Rev.=July 2014 = added crm resource rsc4
7.Rev.=Aug.2014 =add #history, Tab key and Michael (Sandy-UK) Gallard's suggestion = # ls -hlt => "h= human"
8.Rev. = Oct.2104 = echo "" > file_name_to_empty
9.Rev. = May 2015 = added interpretation for #service ntp status
= Under Construction... ; changing on the fly....
1
0. Scope & Help:
OS4k & HP4k V6 are based on SUSE Linux OS and runs Linux-VM for Assistant & CSTA.
This doc. shows useful commands examples for daily work and help you to like Susy-Linux & VM....
For FTP and how to access Linux, consult the doc. "V6 Accessibility and Shutdown Procedures.pdf";
locate on http://tac.global-intra.net => Large Platform -> HiPath4000 V6 -> Reference and Config. docs. and on GSI.flow => KM
# command --help => e.g.: # df --help => get help on arguments "-x" (linux -secret)
# man command => # man df => to get out of manual help => Ctrl Z
# ls /bin => displays most of commands
/bin = binary = where the executables are, can be also on /sbin, /cla/bin, etc...
# whatis command
OM-dp2B:~ # whatis df
df (1) - report file system disk space usage
df (1p) - report free disk space
# whereis command
OM-dp2B:~ # whereis df
df: /bin/df /usr/share/man/man1/df.1.gz /usr/share/man/man1p/df.1p.gz
##################################################################################################
Example:
HP4K-COR2-COL:~ # crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXX4ZmFLr installed on Fri Sep 28 12:02:02 2012)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
0 * * * * /var/opt/linux-basicinit/Cron-SC2HWC.sh
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * *
/opt/cla/bin/checkcla
* * * * * /usr/sbin/systemdiag.sh
0 1 * * * service sysinfod stop
2 1 * * * service sysinfod start
2
II. DSCXL2 processor card:
BIOS version date for VXCC0001 is 02/08/2010 which is the correct/needed version on V6R1.
BIOS date for VXCC0002 is 08/06/2010 which is the faulty version.
BIOS =Basic Input Output System = FirmWare for initialization (boot) of card (motherboard)...
# /usr/sbin/dmidecode -s bios-release-date
12/12/2011 => for V6R2 VXCC0004
JW-Srv-kit:~ # checkydata
V6_R2.14.5
Version Check OK
JW-Srv-kit:~ # cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64) => VERSION = 11 => PATCHLEVEL = 1
JW-Srv-kit:~ # cat /proc/version or Display Linux kernel: # uname –r or -a = all
OM-hpa60:~ # uname -a
Linux OM-hpa60 2.6.32.59-0.7-default #1 SMP 2012-07-13 15:50:56 +0200 x86_64 x86_64 x86_64 GNU/Linux
/* This kernel corrects the 208days issue /*
!! Do NOT install Linux patch directly yourself; those are delivered by SEN in format of HP4k V6 PLaTform (PLT) Hot Fix.
Do NOT try to change the Linux behaviour as e.g. delete/change kernell files; will have bad collateral effects as restart, apps broke.
From V6R2 Linux-host is running on Novell: SUSE Linux Enterprise Server "JeOS" (Just enough Operating System based on SLES 11 SP1)..
The JeOS is informally called also as "Jesus" = Just Enough SUSe linux OS !!
---------------------------------------------------------------------------------------------------------------------------------------------------------------
OM-dp2B:~ # free -g => Memory in Gigabyte
total used free shared buffers cached
Mem: 3 3 0 0 0 0
-/+ buffers/cache: 2 1
Swap: 15 0 15
3
III. Directory:
############################################################
####################################################################################################
V. Files:
4
Abort the view of a file:
Ctrl C or Ctrl Z or Ctrl Q or Delete "Key"; one of them should work...
Find a file:
# find / -name file_name (e.g.: #find / -name message* )
# find /opt -size +500M => find files bigger than 500M on directory /opt
House2-hipath4000v6:/opt/dscxl/share # ls -hlt
total 5.9G
-rw-rw-rw- 1 root root 2.9G Aug 27 08:12 hicom_2011_08_05_21_36.img
-rw-r--r-- 1 root root 214M Apr 23 09:03 RMX-db_save.img.bz2
-rw-rw-rw- 1 root root 2.9G Apr 23 08:54 hicom_second_harddisk.img
lrwxrwxrwx 1 root root 42 Apr 23 08:50 hicom_second.img ->
/opt/dscxl/share/hicom_second_harddisk.img
lrwxrwxrwx 1 root root 43 Aug 5 2011 hicom_ccap.img ->
/opt/dscxl/share/hicom_2011_08_05_21_36.img
lrwxrwxrwx 1 root root 43 Aug 5 2011 hicom.img -> /opt/dscxl/share/hicom_2011_08_05_21_36.img
drwx------ 2 root root 16K Nov 18 2010 lost+found
OM-Srv-kit:/var/opt/soco/config # l
total 36
drwxrwxrwx 8 root root 4096 Oct 31 04:39 ./
drwxr-xr-x 14 root root 4096 Nov 1 09:44 ../
-rw-r----- 1 root root 2804 Oct 31 15:01 initialcfg.xml
drwxr-x--- 2 root root 4096 Oct 31 12:14 pbc_1/
drwxr-x--- 2 root root 4096 Oct 31 04:39 pbc_11/
drwxr-x--- 3 root root 4096 Oct 31 04:31 pbc_2/
drwxrwxrwx 2 root root 4096 Nov 11 15:17 pbc_21/
drwxr-x--- 3 root root 4096 Oct 31 04:32 pbc_4/
drwxrwxrwx 4 root root 4096 Jul 17 2011 tones/
OM-Srv-kit:/var/opt/soco/config # l -t
drwxrwxrwx 2 root root 4096 Nov 11 15:17 pbc_21/
-rw-r----- 1 root root 2804 Oct 31 15:01 initialcfg.xml
drwxr-x--- 2 root root 4096 Oct 31 12:14 pbc_1/
.......... . .... .... .... ... .. .. .. .....
OM-Srv-kit:/var/opt/soco/config # ls
initialcfg.xml pbc_1 pbc_11 pbc_2 pbc_21 pbc_4 tones
5
Permissions:
linux:/.AS/SWS # l -t
example:
-rwxr-xr-- 1 root unity 1425369 Dec 23 17:49 act_history.tgz
# chmod xxx filename => change mode permissions as others need for e.g. file transfer....
soco2-sys2:/tmp # l Mo*
- rw- --- --- 1 root root 107035645 May 11 08:10 MoriyaTrace.pcap
soco2-sys2:/tmp # chmod 754 MoriyaTrace.pcap
soco2-sys2:/tmp # l Mo*
- rwx r-x r-- 1 root root 107035645 May 11 08:10 MoriyaTrace.pcap
# egrep -i "restart" /var/log/messages => find the word restart inside the file (messages).
# bzcat /var/log/messages-2013* |egrep -i "restart" => find inside zipped files.
###############################################################################
6
VI. Hard Disk:
Partition size usage...
OM-dp2A:/ # df -h => disk free -human understandable
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/dscxl-root
60G 4.8G 52G 9% /
devtmpfs 1.9G 436K 1.9G 1% /dev
tmpfs 1.9G 19M 1.9G 1% /dev/shm
/dev/md0 989M 77M 862M 9% /boot
/dev/mapper/dscxl-images
9.9G 1.1G 8.3G 12% /mnt/images
/dev/mapper/dscxl-var
40G 18G 21G 47% /var
/dev/drbd1 30G 21G 7.9G 73% /opt/Assistant/share
/dev/drbd0 20G 5.9G 13G 32% /opt/dscxl/share
/dev/drbd2 18G 5.7G 12G 34% /opt/CAP_Inside/share
/dev/drbd3 30G 2.3G 26G 8% /var/pgsql
# find /opt -size +500M => find files bigger than 500M on directory /opt
HD Info:
OM-dp2A:~ # smartctl -a /dev/sda
smartctl 5.39 2008-10-24 22:33 [x86_64-suse-linux-gnu] (openSUSE RPM)
Copyright (C) 2002-8 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Device Model: ST9250410AS
Serial Number: 5VGBLXSH
Firmware Version: 0002SDM1
User Capacity: 250,059,350,016 bytes
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 8
ATA Standard is: ATA-8-ACS revision 4
#############################################################################
7
VIII. Network on Linux-host:
# ifconfig /* or specific port #ifconfig eth0 =>shows MAC address, ip/netmask, frame errors....
OM-dp2A:~ # ifconfig eth0 => interface config.
eth0 Link encap:Ethernet HWaddr 00:20:CE:DF:BA:70
inet addr:172.19.208.201 Bcast:172.19.208.255 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9226595 errors:0 dropped:0 overruns:0 frame:0 => if shows errors, FCK
TX packets:4563134 errors:0 dropped:0 overruns:0 carrier:0 =>check w/IT, port settings.
collisions:0 txqueuelen:1000
# ethtool or # ethtool eth0 => show current running speed:1000Mb/s => 1Gbit Full Duplex
OM-dp2A:~ # ethtool eth0 => ethernet tool lan_port => Settings for eth0:
Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
Link detected: yes
8
IX. Search:
# find / -name blabla* =>find a file blabla.... starting on initial directory / => all disk....
# grep -i bleble* filename => find the word B(b)leble [-i=ignore case (lower or upper)] inside the file.
= Global Regular ExPression (grep)
To use 2 commands together use "|" pipe sign key...
OM-dp2A:~ # find / -name *irst* | grep -i instal
/opt/fiw/FirstInstallWizard => found directory with irst and the work instal together
/var/opt/soco2/installrepo/FirstInstallWizard
/var/opt/sysbackup/sysbackup_2012_12_05_17/FirstInstallWizard
/var/log/firstinstall.log
/usr/share/autoinstall/modules/firstboot.desktop
linux: # find /opt -size +5G => find files bigger than 5G on directory /opt
linux: # find /opt -size +50000 | sort -nr => sort files from big size to small (-nr=numeric and reverse)
linux:/ # find / -size +50000 | sort -nr | head -4 => + head = show only 4 results
/var/repgen/reports_prerestore/setup.exe
/var/hf/ape/PLT-V6_R1.12.1.tar
/var/hf/ape/CSTA-V1_R11.204.1.tar
/var/hf/ADP-V6_R1.13.7.tar
# egrep -i "restart" /var/log/messages => find the word restart inside the file (messages).
# bzcat /var/log/messages-2013* |egrep -i "restart" => find inside zipped files.
The other lazy way to type is initiating some letter and hiting Tab key to let Linux complete for you,
this works for directories, files & commands. I love it with my hamburguer.
#################################################################################
9
X. Shutdown => try first to use Portal -> Maintenance -> Shutdown/Reboot
=> if Portal is down; # shutdown -h now or # init 0 or # halt or # poweroff
=> don't shutdown remotely; customer will kill you !! |_,--> Power Off / ON => Cold reboot
=> bring back, pull and insert back the DSCXL2 card. If server power off / on...
Restart = Reload = Reboot => # shutdown -r +2 or # init 6 or # reboot => Warm reboot
shutdown -r +2 => r=restart +2= wait 2 minutes; during the 2 min. can abort with "Ctrl C"
# last -x|grep -e shutdown -e reboot ==> History of restarts occurred...
or only # last | more
Restart of Portal: # service webservice stop (do on the active running adp -. processor)
# service webservice start (can cause Linux-host/entire both servers restart;
if system was not running clean !! )
or use only # service webservice restart
or also # crm resource restart rsc4k_webservice
Restart of VM Assistant/CSTA: # virsh shutdown Assistant/CSTA ( entire VM and all its resources)
# service network stop => a restart on SWU will occur as eth0 goes down...
# service network start => or if you're on /etc/init.d/ => ./network restart
OM-dp2A:/etc/init.d # ls
........ boot.swap network skeleton.compat
apache2 boot.sysctl network-remotefs slpd
apcupsd boot.sysstat nfs smartd
apcupsd_configure boot.udev nfsserver smb
atd boot.udev_retry nmb smbfs
auditd cla nscd snmpd
autofs cron ntp soco2
autoyast cups openais spamd
bluez-coldplug dbus openct splash
boot.apparmor drbd openwsmand sshd
boot.bios_dscxl earlysyslog pcscd sysinfod
boot.cleanup ebtables plt_upgrade syslog
boot.clock fbset pm-profiler tmuxd
boot.crypto frontpanel postfix tunnelbroker
boot.crypto-early frontpanel_dbus postgresql unfsd
boot.cycle gpm powerd uuidd
boot.d haldaemon powerfail vmblock
boot.ksm jexec rc4.d watchdog
boot.ldconfig joystic webservice ........
#############################################################
10
XI. SW - Apps - Install / Manipulations:
RPM: - Recursive Package Manager.
# rpm -qa | less => -query -all = list all installed packages; |less = stop per page
linux:~ # rpm -qa AS* => list ASsistant packages
OM-dp2A:~ # rpm -qi cla => query installed version
Name : cla Relocations: /opt
Version : v1 Vendor: Siemens Enterprise Communications GmbH
Release : r25.1.0 Build Date: Fri Mar 8 03:29:46 2013
# rpm -ihv file.rpm => -install -hash mark for progress "###.." -verbose (detailed output)
# rpm -Uhv file.rpm => -Upgrade /* prefered command also for install as -i does not check exist package.
# rpm -ev package => -erase
Example:
linux:/ # rpm -qa ASt*
AStao-07.100-0012
AStska-07.100-0001
11
XII. Time I have 4 U:
12.1. On Linux-host, display date & time => # date
Example: OM-dp2A:~ # date
Sun Jun 23 09:01:48 CDT 2013 => CDT = Central Daylight Time = (US Central Summer Timezone)
12.2. Changing time directly on Linux-Host command line, if duplex do on both processors:
(If V6R2.15.0, must apply PLT Hot Fix 1, otherwise a system restart occurs when change date !!!)
# date -s 17:25 or
# date -s "YYYY-MM-TT hh:mm:ss"
# date -s "2012-12-31 09:51:24" => date & time. changed
12.3. To change TIMEZONE in Linux; call " # yast " ->System; as figure below on Chapter 12.7.Time with NTP....
12.4. If duplex system, need to do steps above on both DSCXL2 cards.
Remotely, jump from one Linux to other doing:
# ssh root@hostname or # ssh [email protected]
# exit =>to leave ssh far host (yast.ip can be found pressing display button on portal)
12.5. Assistant->Base Administration -> Webmin-> Set TimeZone (this propagates lately to RMX)
Note: CHANGE-DATE should not be used during high traffic because it forces (beside other things) immediately time-update of all phone-
devices. Several individual messages per device will be generated in the BP and transferred all the way down to the devices. In large PBXs this
will produce a lot of traffic and big load in the BP and in the LTUs. It will take several minutes to process all devices and may interfere with other
CP-activities. (Calls may be delayed ...). If still the same, restart SLMO cards...
Assistant first page; TimeZone showing "! Warning" (below fig.) is corrected with ADP V6 r2.34 Hf4 and V6 r1.HF10
12
12.7. Time with NTP:
NTP is highly recommended as the clock of DSCXL2 has deviation. Do the ntp changes on both linux-host dsxcl2 cards.
Prepare NTP to avoid jumps:
# sntp -r ntp.ip.address => e.g. #sntp -r 172.19.223.99 /* -r eset = sync to NTP server time & date
# hwclock --systoh --noadjfile --utc /* systoh=set the hw clock to the current system time
# yast => to call yast use PuTTY, the assistant->expert mode->ssh gives garbage on blue window display...
if you're on V6R2 go to Portal -> System -> Shell to Host root/hicom #yast
=> System => Date and Time Use Tab Key to jump fields
[X] HW Clock Set to UTC = sync Bios clock on shutdown. Can access DSCXL2 Bios with F4 or Delete key on boot...; F2 on HPA500....
If user changed via Yast->Date&Time -> the option "HW clock set to UTC", then it is mandatory to execute after closing the Yast the following
command from a shell with root access: /sbin/mkinitrd
13
12.8. Monitor:
# service ntp status or # ntpq -p...
om-ape25:~ # service ntp status
remote refid st t when poll reach delay offset jitter
==============================================================================
*172.19.208.150 LOCAL(0) 6 u 107 128 377 0.001 39.472 426.915
Interpretation:
The " * " asterisk in front of NTP ip address means:
“ * ” – The remote peer or server presently used as the primary reference.
refid – Where or what the remote peer or server is itself synchronised to;
An IP address – The IP address of a remote peer or server;
.LOCL. – This local host (a place marker at the lowest stratum included in case there are no remote peers or servers available);
.GPS. – American GPS;
.BCST. – broadcast server;
.INIT. – association initialized;
.DENY. – access denied by server;
.TIME. – association timeout;
.STEP. – step time change, the offset is less than the panic threshold (1000ms) but greater than the step threshold (125ms).
The st column shows the stratum of the server, with stratum 1 servers having a local reference such as an atomic clock or, for many servers, a
radio-clock or GPS receiver reference. Most servers you will see are at stratum 2, so they are locked to a stratum-1 server. A lightly loaded
stratum-2 server is probably a better reference than a heavily loaded stratum-1 server such as those with widely-publicised addresses.
t – Type (u: unicast or manycast client, b: broadcast or multicast client, l: local reference clock, s: symmetric peer, A: manycast server, B:
broadcast server, M: multicast server, see “Automatic Server Discovery“);
when – When last polled (seconds ago, “h” hours ago, or “d” days ago);
The poll value should gradually increase from 64 seconds to 1024 seconds as NTP needs to contact the
server less and less frequently as the clock offset and frequency are gradually corrected. Changing the poll
is automatic in NTP.
The reach column should not be 0, and will expand from 1 during the normal working of NTP until it reaches 377. It is an octal display of a bit-
mask showing when the server was reached.
Normally you expect to see 377 in this column against each server.
A column of all zeros means that NTP can't contact any servers - check your firewall settings.
The delay shows the time for a packet from your PC to reach the remote server and vice versa. Values above 150ms may indicate a satellite
circuit and it's best to avoid such servers if possible. You will get best performance from servers which are close to you on the network.
The offset shows how far your PC is off from a nominal UTC, and the value is in milliseconds. So the PC above is within about 1/40s of correct
time!
The jitter column shows how stable the connection between you and the remote server is.
14
XIII. Troubleshoot:
OM-dp2B:~ # w => who what when (only how long the system is up = # uptime )
13:01:58 up 25 days, 19:53, 7 users, load average: 0.61, 0.47, 0.45
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
root tty1 Wed17 2days 0.06s 0.06s -bash
root pts/9 13:01 0.00s 0.04s 0.00s w
root pts/7 08:59 1:56m 0.06s 0.06s -bash
linux:~ # ps axjf => job file = where the PID comes from....
linux:~ # lsof | grep TSKA => list open file | search word "TSKA"
TSKA_Star 6515 tska cwd DIR 253,3 4096 277748 /opt/tska/bin
TSKA_Star 6515 tska txt REG 253,3 93483 277983 /opt/tska/bin/TSKA_Starter
TSKA_Star 6515 tska 0u IPv4 13872 TCP *:9980 (LISTEN)
TSKA_Star 6515 tska 2w CHR 1,3 2010 /dev/null
TSKA_Star 6515 tska 5r REG 253,3 0 51520 /opt/procm/cnfg/DB_LockFilelii
15
# kill PID => = #kill -15 = SIGTERM , termination signal allows to remove temporary files created.
# kill -9 PID => -9=no mercy => Process IDentification killed immediately.
# kill -9 16369 => properly for Halloween...16369 -> Stat => Z as zombie
------------------------------------------------------------------------------------------------------------------------------
Wireshark changed inside OS4k V7 (by Nathan Hughes), internal rpm is now at
# find / -name wireshark*
./opt/soco/rpm/wireshark
./opt/soco/rpm/wireshark/wireshark-1.0.5-1.24.x86_64.rpm
After copy it over to the /var/opt/soco2/installrepo/ directory and installing it:
# rpm -Uvh /var/opt/soco2/installrepo/wireshark-1.0.5-1.34.1.x86_64.rpm
When I run it to the screen it will capture between 30 and 70 packets and then stop itself each time.
# tethereal -n -ieth0 host <ip.address.of.host>
But if I use the –w switch and write it to a file it seems to work fine.
# tethereal -n -ieth0 host <ip.address.of.host> -w <file_name> -S
------------------------------------------------------------------------------------------------------------------------------------------
If during a period of ca. 10 Minutes this message appeares more than 1 time, then the problem exists and the
webservice rpm should be installed as follows:
# rpm -Uhv --force /var/opt/soco2/current_hotfix_rpms/webservice-6.2-1.i586.rpm
---------------------------------------------------------------------------------------------------------------------------------------
16
Separated duplex: node can be switched administratively to standalone mode
#standalone_operation enable Other options: disable and status
-------------------------------------------------------------------------------------------------------------------------------------
The information provided in this document contains descriptions or characteristics of performance which in case of actual use do not always apply as described
or which may change as a result of further development of the products.
Availability and technical specifications are subject to change without notice.
An obligation to provide the respective characteristics or support and warranty shall only exist if expressly agreed in the terms of contract.
Neither the author nor Unify shall be liable for errors, omissions or damages resulting from the use of the informations contained herein..
The comments expressed belong to the author and are not necessarily those of Unify Inc.
OpenScape,OpenStage and HiPath are registered trademarks of Unify.
All other company, brand, product and service names are trademarks or registered trademarks of their respective holders.
17