1752780 Members
6518 Online
108789 Solutions
New Discussion юеВ

schedule Script

 
SOLVED
Go to solution
Karthick K S
Frequent Advisor

schedule Script

Hi all,

Is there any possible without using Cronjob there is any other shell script to run some commands every 1 min form 9am to 9pm
14 REPLIES 14
RAC_1
Honored Contributor

Re: schedule Script

at command
man at
man batch
There is no substitute to HARDWORK
Karthick K S
Frequent Advisor

Re: schedule Script

without using at command is there any script
Sandman!
Honored Contributor

Re: schedule Script

Sure you can always use job-scheduling software like Control-M if you don't want to use the Unix tools like at or cron.

:)
Arunvijai_4
Honored Contributor

Re: schedule Script

Use sleep and put it in a loop. It will work

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Karthick K S
Frequent Advisor

Re: schedule Script

OK Thanks Arun i did same like but its working but is there any possible to automatically to go exit after 6PM

i am using output to some file using print command but that output not in good format for eg:

i need like this

ID Name Time

xx yyy yyy
RAC_1
Honored Contributor

Re: schedule Script

some scripting can do it. But why not systems commands for it??-at or cron itself??

Script like follows will do it.
i=0900
while [$i -le 2100]
do
echo $i
((i+=1))
done >> /tmp/test.txt

while true
do
current_time=$(date "+%H%M")
file_time=$(grep -iq ${current_time} /tmp/tes.txt 2>/dev/null)
if [[ ${current_time} -eq ${file_time} ]];then
your_program to be excuted
else
exit 1
fi
done
There is no substitute to HARDWORK
RAC_1
Honored Contributor
Solution

Re: schedule Script

Some corrections.

Prepare a file with timestamps 1 min apart
type -i i=0900
while [ $i -le 2100 ]
do
printf "%.4d\n" $i
((i+=1))
done > /tmp/some_file

Now start this script.
while true
do
current_time=$(date "+%H%M")
file_time=$(grep -iq ${current_time} /tmp/some_file 2>/dev/null)
if [[ ${current_time} -eq ${file_time} ]];then
"execute_your_program"
sleep
fi
done
There is no substitute to HARDWORK
Sandman!
Honored Contributor

Re: schedule Script

Not sure what you mean by???

>> ID Name Time
>> xx yyy yyy
Karthick K S
Frequent Advisor

Re: schedule Script

hi sandman,

i generating some reports to file(report.txt)by using glance

Format should be

CPU Memory Disk
12 78 1

b