|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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
|
|||
|
|||
|
Hi, I am running a schedular script which will check for a specific time and do the job. I wanted to run this continuously. Meaning even after the if condition is true and it executes the job, it should start running again non stop. I am using below script Code:
#!/bin/sh start: while true do hour=$(date +"%T") if [ "$hour" == 18:30:00 ]; then <Do the JOB> goto start fi done The problem I am facing here is its not recognizing start command initially. So i am not able to optimise it. Can anyone help? Last edited by vbe; 02-21-2013 at 04:33 AM.. Reason: code tags please |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
#!/bin/sh
while true
do
hour=$(date +"%T")
if [ "$hour" == 18:30:00 ]; then
<Do the JOB>
fi
doneLast edited by Franklin52; 02-21-2013 at 05:46 AM.. Reason: Code tags |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
The above script will stop running when the if condition becomes true. I want this to run daily at 18:30:00. So I thought of using the goto statement. But it is not helping me as we cannot give start initially.
|
|
#4
|
||||
|
||||
|
Use
crontab to make it run everyday at a certain time. Code:
30 18 * * * /youscript.sh |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
@Jotne: Can you elaborate please? I didn't quite get that. What does 30 mean in the code?
|
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Quote:
Use Jotne's proposal and you're there. P.S.: That START: ... GOTO START is a DOSism, I think. I guess it's unavailable in any *nix shell. |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Quote:
|
| Sponsored Links | ||
|
![]() |
| Tags |
| shell scripting |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Run a script continuously for 10 minutes | Jayaraman | Shell Programming and Scripting | 5 | 07-23-2012 01:14 PM |
| Shell Script to continuously scan a log file | novice82 | Shell Programming and Scripting | 1 | 10-09-2009 01:03 AM |
| How to stop a script running in remote server from local script | mannepalli | Shell Programming and Scripting | 1 | 03-04-2009 07:18 PM |
| How to stop the script which is running in background | Prateek007 | Shell Programming and Scripting | 3 | 11-23-2008 04:54 AM |
| How to stop asking password while running shell script? | govindts | Shell Programming and Scripting | 5 | 11-12-2008 01:40 PM |
|
|