I have a cron shell script which calls a stored procedure to do some operation. I want to know how can I change that cron to a daemon.
Here’s what I have.
#!/bin/ksh
# @(#)abc.sh
. /somedir/env/some_profile
JOBNAME=`basename $0`
LOG_DIR=$PROJHOME/log
LOG_FILE=$LOG_DIR/process_abc.log
function usage
{
echo "${JOBNAME}: Usage: ${JOBNAME}"
echo "Exiting..."
echo "process_abc ended ***UNSUCCESSFULLY*** at `date`" | tee -a $LOG_FILE
echo "" | tee -a $LOG_FILE
exit 1
}
Can you please help. Your help will be appreciated.
Thanks
you can just run it from bash
or you can do the same loop inside the script
this way you can also force the execution of the internal function from the outside
also i would suggest rewriting:
to use $$ (current shell’s pid) and create pid file
(dont forget to remove the pid file @ failure exits)