10-28-2008
Could execute the script (with full path name) once in background with "at now", and then use "at now + 5 hours" at the start of the script to spawn the script again. Needs a simple stop flag to stop the process.
#!/bin/ksh
COMMAND_LINE="$0"
if [ -f /tmp/stop_flag ]
then
exit
fi
echo "${COMMAND_LINE}" | at now + 5 hours
# Rest of the script
#
Note: The 5 hours may drift over a period of time due to cron and shell initialisation times.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
can someone please check my answers for the crontabs I am making
1. how would I set up a crontab tab executes every 2 minutes each and every day of the week?
answer: 2 * * * * /path/to/file.pl <-- is this correct?
2. how would I set up a crontab that executes every 24 hours at 2am?... (6 Replies)
Discussion started by: Bobafart
6 Replies
2. UNIX for Dummies Questions & Answers
Hi friends,
I am not sure if perl questions can be raised here. :rolleyes:
But I have a doubt if there is a way to do "#define" in perl, like in C.
Does anyone know if it is feasible (without CPAN modules)?
Thanks,
Srini (7 Replies)
Discussion started by: srinivasan_85
7 Replies
3. Shell Programming and Scripting
Hi Frens,
I want to list some files from a directory, which contains "DONE" in their name, i am receiving files every minute. In this i want to list all the files which are newer than 6 hours but older than 3 hours, of current time
i dont want my list to contain the latest files which are ... (4 Replies)
Discussion started by: Prat007
4 Replies
4. Programming
Hello,
I would like to conditionaly comment in my code source some fields from arrays. So I use the property ## from the #define definition.
my code:
...
#define slet /##*
#define etsl *##/
...
const T_SVT_ADLL_A653_DESC A_DESC =
{
{ slet qwerty etsl SLICING,... (3 Replies)
Discussion started by: cypleen
3 Replies
5. Programming
if i do this in C
#define NUM 1234512345
then how come i cant print it out using
int main(int argc, char **argv) {
printf("%d\n", NUM);
return 0;
}
well the result is -1219236538, why isnt it 1234512345 ? (7 Replies)
Discussion started by: omega666
7 Replies
6. Programming
Hi,
I had a head file, looks like
#define MIN_NUM 10
#define MAX_NUM 10
is there any way to get "MAX_NUM" from 10?
thanks.
peter (9 Replies)
Discussion started by: laopi
9 Replies
7. UNIX for Dummies Questions & Answers
I want to add a crontab entry which should execute for every 4 hours and that 4 hours calculation should begin from the current time.
Normally if I set the crontab entry like this,
00 */4 30 05 * root date >>/tmp/cronout
The above will execute the date command for every 4 hours like... (7 Replies)
Discussion started by: Ganeshwari
7 Replies
8. HP-UX
Hi All
I have a problem, I wonder if you can help me sort it out:
I have the following entry in the cron:
00 1,13 * * * /home/report/opn_amt_gestores_credito.ksh > opn_amt_gestores_credito.log
But the entry only runs at 01:07
I have stopped the cron deamon, and started, but it still... (39 Replies)
Discussion started by: fretagi
39 Replies
9. Shell Programming and Scripting
Hi,
I just define the variable in script and use those script in another script but the variable not recognize.
test1.sh
#!/bin/bash
DB="test_db"
USR="test_user"
PWD="test_pwd"
HST="24.254.87.12"
test2.sh
#!/bin/bash
./test1.sh
mysql -u $USR -p $PWD -h $HST... (2 Replies)
Discussion started by: fspalero
2 Replies
LEARN ABOUT CENTOS
service
service(8) System Manager's Manual service(8)
NAME
service - run a System V init script
SYNOPSIS
service SCRIPT COMMAND [OPTIONS]
service --status-all
service --help | -h | --version
DESCRIPTION
service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working
directory set to /.
The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the
invoked script, service passes COMMAND and OPTIONS it to the init script unmodified. All scripts should support at least the start and
stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start
command.
service --status-all runs all init scripts, in alphabetical order, with the status command.
If the init script file does not exist, the script tries to use legacy actions. If there is no suitable legacy action found and COMMAND is
one of actions specified in LSB Core Specification, input is redirected to the systemctl. Otherwise the command fails with return code 2.
FILES
/etc/init.d
The directory containing System V init scripts.
ENVIRONMENT
LANG, TERM
The only environment variables passed to the init scripts.
SEE ALSO
chkconfig(8), ntsysv(8), systemd(1), systemctl(8), systemd.service(5)
Jan 2006 service(8)