Sponsored Content
Top Forums Shell Programming and Scripting Cron doesn't run job in background Post 302881162 by PikK45 on Thursday 26th of December 2013 11:44:42 PM
Old 12-27-2013
Yeah... Don's right.. We could have set a working directory at beginning of the script. That would save all the confusions. Add some logging too Smilie Helps in debugging

Code:
#!/bin/bash
EXEC_DIR=/home/sam
cd $EXEC_DIR

/bin/bash $EXEC_DIR/chk_job_end.sh &

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Run cron job problem

I have the below crontab job that it will run at every 7:00am - 10:00am , it work fine , now if I want to skip to run the crontab job at a specific time , eg. I want the script not to run at next Monday 8:00am ( only skip this time , other time is normal ) , how can I make it ? is it possible ?... (3 Replies)
Discussion started by: ust
3 Replies

2. Shell Programming and Scripting

Run a job in background for infinte time

Hello All, I would like to know if it is possible to launch a job in background for infinite time. example: myScript.ksh while true do ( echo "(`date`)"; top -U user | grep 'Memory:' ) >> log & sleep 1800 done and when i do... (5 Replies)
Discussion started by: midhun_u
5 Replies

3. Shell Programming and Scripting

Does not run via cron job

I have a perl script, when I ran manually it works perfect. I check the permissions which are fine. How can I find out why it is not running? how can I setup a log to check. I am running it on solaris 9. It compares multiple files, SCP and then send out an e-mail. As I said when I ran it... (2 Replies)
Discussion started by: amir07
2 Replies

4. Shell Programming and Scripting

Script doesn't work as expected when run on cron

The script checks for free space stats on Oracle. If there are any tablespaces with more than 85% usage it prints the details of the tablespace. If all the tablespaces have more than 15% free space, then "All tablespaces have more than 15 pct free space" must be printed on the screen. When I run... (2 Replies)
Discussion started by: RoshniMehta
2 Replies

5. UNIX for Advanced & Expert Users

Need help with a script run by a cron job.

Hi, new to this forum and not sure if this is the right place to post. I'm new to cron jobs and scripts, and I need some help with a script to be used with a cron job. I already have a bot set up at a certain website address and need a script that the cron job will load every day that tells it to... (1 Reply)
Discussion started by: klawless
1 Replies

6. Solaris

Is user cron job running in background?

Hi, Should the user jobs specified in crontab be running in background? Cron daemon is already running in background. So I am not sure whether should the jobs (output and error messages are redirected to file) ran by it be explicitly stated to be run in background (& at end of command) if one... (1 Reply)
Discussion started by: joe_x
1 Replies

7. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

8. Shell Programming and Scripting

Cron Job to Run for 30 minutes

Hello Gurus, I have a requirement to run a job from cron only for 30 minutes duration daily twice at 8.35 am and 20.35 pm Can you please suggest how to schedule the job? Thanks- Pokhraj (5 Replies)
Discussion started by: pokhraj_d
5 Replies

9. Shell Programming and Scripting

Cron Job to Run every 2 minutes

Hello Gurus, I want to schedule a cron job which will run every 2 minutes starts at 11:25 AM and 3:25 AM daily. Can you please suggest as how to schedule the job. Thanks- Pokhraj Das (2 Replies)
Discussion started by: pokhraj_d
2 Replies

10. Shell Programming and Scripting

Cron job cannot run the command

Hi, I created this cron job for asterisk to send sms daily to a number #!/bin/sh #custom mod - send sms once a day, at 07:00. CRON_PATH="/etc/asterisk/gw/crontabs_root"; if ! grep 'gsm send sms' $CRON_PATH > /dev/null 2>&1 ;then echo "* 7 * * * asterisk -rx 'gsm send sms 1 7666... (4 Replies)
Discussion started by: jazzyzha
4 Replies
bg(1)							      General Commands Manual							     bg(1)

NAME
bg - Runs jobs in the background SYNOPSIS
bg [job_id...] Note The C shell has a built-in version of the bg command. If you are using the C shell, and want to guarantee that you are using the command described here, you must specify the full path /usr/bin/bg. See the csh(1) reference page for a description of the built-in command. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: bg: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None OPERANDS
Specifies the job to be resumed as a background job. If no job_id operand is given, the most recently suspended job is used. The format of job_id is described in the Jobs section of the ksh(1) reference page. DESCRIPTION
If job control is enabled (see the description of set -m in the ksh(1) reference page), the bg utility resumes suspended jobs from the cur- rent environment by running them as background jobs. If the job specified by job_id is a job already running in the background, the bg utility has no effect and will exit successfully. Using bg to place a job into the background causes its process ID to become "known in the current shell execution environment", as if it had been started as an asynchronous list. See the Jobs section of the ksh(1) reference page. RESTRICTIONS
If job control is disabled, the bg utility exits with an error and no job is placed in the background. The bg utility does not work as expected when it is operating in its own utility execution environment because that environment has no suspended jobs. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. ENVIRONMENT VARIABLES
The following environment variables affect the execution of bg: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale used to affect the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: csh(1), fg(1), jobs(1), kill(1), ksh(1), Bourne shell sh(1b), POSIX shell sh(1p), wait(1) Standards: standards(5) bg(1)
All times are GMT -4. The time now is 07:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy