|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Scripting Issue
needing this script to shut down 1 IceS and start up another, close the 2nd one after 12 seconds and then reboot. here is what i have so far Code:
#!/bin/bash
ShutDown() {
echo "Shutdown in progress."
wall <<ENDOFWALL
CI Shutdown has been intiated!!!!
Shutdown will occur in 30 seconds...
ENDOFWALL
sleep 18
killall ices
echo "Starting the Shutdown IceS"
ices -c-b /usr/local/etc/shutdown.conf.dist
sleep 12s
killall ices
echo "Reboot command goes here"
}
clear
echo "Are you sure you want to REBOOT the Collective Industries server? (Y/n)"
read answer
if [ $answer = Y ]
then
ShutDown
if [ $answer = n ]
then
echo "Shutdown has been canceled"
fi
fi |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
It helps if you indent the code. Then it is clear the the last fi is in the wrong place and should be put a few lines earlier. Also, any other character will result in cancellation, only "n'" will produce a message stating that the shutdown has been canceled. Also the double quotes ensure the input is handled well if someone just hits enter... Code:
if [ "$answer" = "Y" ]; then ShutDown else echo "Shutdown has been canceled" fi If you are using killall (hopefully on linux, on many other unixen killall means something very different that you probably do not want to use) then how do you kill the first en only kill the second later, seeing as killall is indiscriminate if two processes carry the same name. I would consider determining the pid and kill that or preferrably use the script that came with the application. |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Scripting Issue | lsudubee | Shell Programming and Scripting | 1 | 07-08-2010 02:13 PM |
| scripting issue | mraghunandanan | Shell Programming and Scripting | 1 | 05-19-2009 06:36 AM |
| IP-Scripting Issue | mraghunandanan | Shell Programming and Scripting | 3 | 05-08-2009 04:28 PM |
| Awk scripting issue | hcclnoodles | Shell Programming and Scripting | 3 | 01-18-2005 08:23 AM |
| scripting issue | moe2266 | Shell Programming and Scripting | 2 | 01-05-2005 09:32 AM |
|
|