"Help with bash script" - "License Server and Patch Updates"


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers "Help with bash script" - "License Server and Patch Updates"
# 22  
Old 04-01-2014
Thanks guys,

I have corrected the syntax as shown below. There is a space AND not tab space between if and square bracket and space btw ==

Code:
if [ "$PATCHACTION" == "restartXAPI" ]
then
        /opt/xensource/bin/xe-toolstack-restart
        sleep 60
elif [ "$PATCHACTION" == "restartHost" ]; then
        reboot;
        sleep 60
fi

The error message below popped up instead.

Code:
[root@xen01 ~]# ./postscript.sh
Secondboot
sleeping in 60 secs
Uploading Update ls /tmp/updates...
Operation failed. Error: file '/tmp/Updates/ls' does not exist
installing Update ls /tmp/updates...
The uuid you supplied was invalid.
type: pool_patch
uuid:
rm: cannot remove `/tmp/updates': Is a directory

Broadcast message from root (pts/1) (Tue Apr  1 17:29:28 2014):

The system is going down for reboot NOW!
[root@xen01 ~]#

The server rebooted without the patches being applied.
# 23  
Old 04-01-2014
you have to change the symbol in the "for" loop from ' to `

Code:
for updatefile in `ls /tmp/updates`;do

# 24  
Old 04-01-2014
Hi Npandith,

Thanks for the response, I don't quite understand you meant:

The syntax below is what I currently have: are you saying I should change the for to "for" ?
Code:
for updatefile in 'ls /tmp/updates';do

# 25  
Old 04-01-2014
Instead of single quote ' use ` (which is next to "1" in the keyboard or along with "~")

Before-
Code:
for updatefile in 'ls /tmp/updates';do


After changing-

Code:
for updatefile in `ls /tmp/updates`;do

# 26  
Old 04-01-2014
Thanks Npandith,

` and ' are indeed different...

I'll get back to you shortly..

---------- Post updated at 07:40 PM ---------- Previous update was at 06:23 PM ----------

Hi Npandith and Sea VBS,

Thanks all for your candid help...

whilst progress made is sloow, it rather further sheds some light on what's happening.
Error 1:
When I manually patch-apply and updating the file-name= capital letter e.g. XS62E001.xsupdates, the patch install successfully. The patches are all in capital letters like such XS62E001 , 002 etc but instead reports file does not exist as shown below when ran via script. I thereafter changed on all patch to lower case letters, same result.
Error 2:
pool_patch being reported is another confusing bit, the syntax say patch-apply for a single server and pool-patch-apply for a group of servers in a pool. I'm still researching the proper syntax for a server vs pools of server.

Any tips regarding Error 1 would be nice to resolve for now guys.?

Thanks for your help.

Code:
./postscript.sh
mkdir: cannot create directory `updates': File exists
./postscript.sh: line 11: echo Downloading updates...: command not found
--2014-04-01 19:20:00--  ftp://192.168.10.5/FTP/xen62/*.xsupdate
           => `.listing'
Connecting to 192.168.10.5:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /FTP/xen62 ... done.
==> PASV ... done.    ==> LIST ... done.

    [ <=>                                                                                                                           ] 951         --.-K/s   in 0.005s

2014-04-01 19:20:02 (170 KB/s) - `.listing' saved [951]

Removed `.listing'.
--2014-04-01 19:20:02--  ftp://192.168.10.5/FTP/xen62/XS62E001.xsupdate
           => `XS62E001.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E001.xsupdate ... done.
Length: 6625641 (6.3M)

100%[==============================================================================================================================>] 6,625,641   --.-K/s   in 0.1s

2014-04-01 19:20:02 (56.1 MB/s) - `XS62E001.xsupdate' saved [6625641]

--2014-04-01 19:20:02--  ftp://192.168.10.5/FTP/xen62/XS62E002.xsupdate
           => `XS62E002.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E002.xsupdate ... done.
Length: 1743501 (1.7M)

100%[==============================================================================================================================>] 1,743,501   --.-K/s   in 0.03s

2014-04-01 19:20:02 (52.3 MB/s) - `XS62E002.xsupdate' saved [1743501]

--2014-04-01 19:20:02--  ftp://192.168.10.5/FTP/xen62/XS62E004.xsupdate
           => `XS62E004.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E004.xsupdate ... done.
Length: 35766769 (34M)

100%[==============================================================================================================================>] 35,766,769  77.2M/s   in 0.4s

2014-04-01 19:20:02 (77.2 MB/s) - `XS62E004.xsupdate' saved [35766769]

--2014-04-01 19:20:02--  ftp://192.168.10.5/FTP/xen62/XS62E005.xsupdate
           => `XS62E005.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E005.xsupdate ... done.
Length: 9315631 (8.9M)

100%[==============================================================================================================================>] 9,315,631   19.8M/s   in 0.4s

2014-04-01 19:20:03 (19.8 MB/s) - `XS62E005.xsupdate' saved [9315631]

--2014-04-01 19:20:03--  ftp://192.168.10.5/FTP/xen62/XS62E010.xsupdate
           => `XS62E010.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E010.xsupdate ... done.
Length: 252927 (247K)

100%[==============================================================================================================================>] 252,927     --.-K/s   in 0.002s

2014-04-01 19:20:03 (98.1 MB/s) - `XS62E010.xsupdate' saved [252927]

--2014-04-01 19:20:03--  ftp://192.168.10.5/FTP/xen62/XS62E011.xsupdate
           => `XS62E011.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E011.xsupdate ... done.
Length: 845698 (826K)

100%[==============================================================================================================================>] 845,698     --.-K/s   in 0.008s

2014-04-01 19:20:03 (101 MB/s) - `XS62E011.xsupdate' saved [845698]

--2014-04-01 19:20:03--  ftp://192.168.10.5/FTP/xen62/XS62E012.xsupdate
           => `XS62E012.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E012.xsupdate ... done.
Length: 35767767 (34M)

100%[==============================================================================================================================>] 35,767,767  52.5M/s   in 0.6s

2014-04-01 19:20:03 (52.5 MB/s) - `XS62E012.xsupdate' saved [35767767]

--2014-04-01 19:20:03--  ftp://192.168.10.5/FTP/xen62/XS62E014.xsupdate
           => `XS62E014.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62E014.xsupdate ... done.
Length: 1745433 (1.7M)

100%[==============================================================================================================================>] 1,745,433   10.6M/s   in 0.2s

2014-04-01 19:20:04 (10.6 MB/s) - `XS62E014.xsupdate' saved [1745433]

--2014-04-01 19:20:04--  ftp://192.168.10.5/FTP/xen62/XS62ESP1002.xsupdate
           => `XS62ESP1002.xsupdate'
==> CWD not required.
==> PASV ... done.    ==> RETR XS62ESP1002.xsupdate ... done.
Length: 1744985 (1.7M)

100%[==============================================================================================================================>] 1,744,985   --.-K/s   in 0.02s

2014-04-01 19:20:04 (95.1 MB/s) - `XS62ESP1002.xsupdate' saved [1744985]

sleeping in 60 secs
Uploading Update xs62E001.xsupdate...
Operation failed. Error: file '/tmp/Updates/xs62E001.xsupdate' does not exist
installing Update xs62E001.xsupdate...
The uuid you supplied was invalid.
type: pool_patch
uuid:
sleeping in 60 secs
Uploading Update XS62E001.xsupdate...
Operation failed. Error: file '/tmp/Updates/XS62E001.xsupdate' does not exist
installing Update XS62E001.xsupdate...
The uuid you supplied was invalid.
type: pool_patch
uuid:
sleeping in 60 secs
Uploading Update xs62E002.xsupdate...
Operation failed. Error: file '/tmp/Updates/xs62E002.xsupdate' does not exist
installing Update xs62E002.xsupdate...
The uuid you supplied was invalid.
type: pool_patch
uuid:
sleeping in 60 secs
Uploading Update XS62E002.xsupdate...
Operation failed. Error: file '/tmp/Updates/XS62E002.xsupdate' does not exist

 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Simplify Bash Script Using "sed" Or "awk"

Input file: 2 aux003.net3.com error12 6 awn0117.net1.com error13 84 aux008 error14 29 aux001.ha.ux.isd.com error12 209 aux002.vm.ux.isd.com error34 21 alx0027.vm.net2.com error12 227 dux001.net5.com error123 22 us008.dot.net2.com error121 13 us009.net2.com error129Expected Output: 2... (4 Replies)
Discussion started by: sQew
4 Replies

7. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question