![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script running with "ksh" dumping core but not with "sh" | simhe02 | HP-UX | 8 | 05-22-2008 02:46 AM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-19-2007 09:52 PM |
| passing a list of dynamic names to a "PS" command in shell script? | sachin.tendulka | Shell Programming and Scripting | 3 | 11-21-2007 12:18 AM |
| Q: Recording shell script screen output using "script" command ? | lalfonso.gomez | Shell Programming and Scripting | 4 | 01-18-2007 05:31 PM |
| Unix "at" / "Cron" Command New Problem...Need help | Mohanraj | UNIX for Dummies Questions & Answers | 3 | 01-26-2006 04:08 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Script scheduling problem using "at" command
Hello!
I'm writing a shell script that will monitor if a server is up or down. I would like to use the command "at" inside of my script to reschedule the script to run in 2 minutes but I can't pass parameters to my script and this is my problem... This is the idea behind the script: 1. The script run in "normal mode" and check if the server is up. If the server is not responding, the script go to step 2. 2. Schedule itself to run in two minutes in "prealert mode" 3. When running in "prealert mode", the script check if the server is still not responding and if not, send a alert to the network administrator. Does anybody know how to pass parameters to a commmand or script while using the "at" command. I know I can put everything in a file and make at use that file but I would prefer not to... Any suggestion? Syntax example to execute the script: ./test_ping prealert server1.test.com Here is a sample of my script: #!/bin/bash #Script to test network connectivity #By Benoit Charbonneau #March 4th 2005 #Parameters ex.: test_ping mode(normal|prealert) server log="../monitoring.log" date=$(date) path=$(pwd) script=$path/test_ping ping -c1 -w2 $2 > /dev/null error=$? if [ $1 = "normal" ]; then if [ $erreur != 0 ] ; then at -f "$script prealert $2" now + 2 minute # My problem is here echo $date $2 ping error - A prealert has been open >> $log else echo $date $2 ping ok >> $log fi fi if [ $1 = "prealert" ]; then ... Sorry if i'm not clear enought. English is not my first language... Thank you for your help! |
| Forum Sponsor | ||
|
|