Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6897953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:14:05+00:00 2026-05-27T07:14:05+00:00

I have a cron shell script which calls a stored procedure to do some

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:14:05+00:00Added an answer on May 27, 2026 at 7:14 am

    you can just run it from bash

    SLEEP_INTERVAL=3600
    (echo $$ > /var/run/script-runner.sh.pid && while :; do script.sh ; sleep $SLEEP_INTERVAL ; done) &
    

    or you can do the same loop inside the script

    trap "function_that_runs_everything" HUP
    echo $$ > /var/run/script.sh.pid
    while :; do
        function_that_runs_everything
        sleep $SLEEP_INTERVAL #or sleep forever just waiting for SIGHUP
    done
    

    this way you can also force the execution of the internal function from the outside

    kill -1 `cat /var/run/script.sh.pid`
    

    also i would suggest rewriting:

    if [ `/usr/ucb/ps -auxww | grep $JOBNAME | grep "sh -c" | grep -v grep  | wc -l` -gt 1 ]
    

    to use $$ (current shell’s pid) and create pid file

    pseudocode:
    PIDFILE=/var/run/`basename $0`.pid
    if $PIDFILE exists
        log and exit
    else
        echo $$ > $PIDFILE
    
    ...
    run
    ...
    rm -f $PIDFILE
    

    (dont forget to remove the pid file @ failure exits)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script in app/vendors/shells which is executed periodically via cron. In that
I have a cron job that call a shell script. */2 * * *
I have a shell script which is called by a cron job. I don't
I have a cron entry that runs a script at a certain time each
I have a cron job to run a Ruby script, which runs fine on
I have a CRON job php script that I just set up not too
If I have a cron job that run every 10 minutes and for some
I have a daily cron job that email PDFs to customers. I want to
I want to run a cron job every minute that will launch a script.
I want to write a shell script which will find the occurence of multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.