Sponsored Content
Operating Systems Solaris Cron Job -- auto start process when it dies Post 302272487 by QEMA on Tuesday 30th of December 2008 06:25:50 PM
Old 12-30-2008
#!/usr/bin/bash
#set environment
logfile=/export/home/log/restart.log
PID=`ps -eo 'tty pid args' | grep 'processname' | grep -v grep | tr -s ' ' | cut -f2 -d ' '`

if [ -z "$PID" ]
then
#Run the process
echo "Started Process at `date`" >> $logfile
else
echo "Process is already Running with PIS=$PID"
fi
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

email notification if job is killed/dies

hi folks, anybody there with suggestions on how to have an email sent to an address (if a certain job (jobA) ever dies. the concern is over the trigerring of sending the email (not the actual sending of the email) 1. is it possible for the job in question, jobA, itself do such a thing... (2 Replies)
Discussion started by: jacob_gs
2 Replies

2. Shell Programming and Scripting

Cron job at system start up

I want to know if there is a way to make a certain set of programs start in order at system startup with cron or something else i dont know about. (3 Replies)
Discussion started by: rcunn87
3 Replies

3. UNIX for Advanced & Expert Users

cron does not start the need job

Hi, can you please help me with one problem? There is some server, there are a lot of AIX applications which run on this server under different UserIDs. These applications starts via crontab. From time to time some application doesn't start. What can this "not-action" be dependent on? At... (5 Replies)
Discussion started by: Anta
5 Replies

4. Shell Programming and Scripting

Auto enable/disable cron job

Hi all, Does anyone know if it is possible to enable/disable a cron job within a script? I currently have a cron job which runs every minute but now it seems that sometimes I would like to turn this job off if a condition is met. I would then like to re-enable the job at a later date. ... (5 Replies)
Discussion started by: pxy2d1
5 Replies

5. UNIX for Dummies Questions & Answers

cron job is unable to process

Hi All, I have got a shell script that excutes some job and mails me the output as an attachment. While running the script manually, its perfect. when i am scheduling the job through crontab, i am getting the mail. but the attachment but this is a blank file. after the scheduler run, i can... (2 Replies)
Discussion started by: gotam
2 Replies

6. UNIX for Dummies Questions & Answers

Setup a cron job and specified the start and end time

Hi guys, How can I specify the start and end time of a cron job. And my start time and end time are specified by minutes. For example, I want to set up a cron runs every 3 minutes from 18:40 to midnight. How can i do this please? Many thanks Best regards, Clu (4 Replies)
Discussion started by: clu
4 Replies

7. Shell Programming and Scripting

Cron job and shell script to kill a process if memory gets to high

Hello, I'd like to set a cron job that runs a shell script every 30 minutes or so to restart a java based service if the memory gets above 80%. Any advice on how to do this? Thanks in advance! - Ryan (19 Replies)
Discussion started by: prometheon123
19 Replies

8. Shell Programming and Scripting

Cron job for MySQL process

Hi, How can I write a cron job that runs the MySQL "show processlist" command and stores in log file every 5 seconds between 5 am to 7 am? I know the lowest possible timing I can have in cron is a minute not second. If I need a script, I am looking for a solution in Bash. I think this cron... (2 Replies)
Discussion started by: riomario
2 Replies

9. UNIX for Beginners Questions & Answers

Howto auto boot SPARC | How to auto supply "start /SYS" and "start /SP/console" commands

When I power ON my T4-1, I got a prompt -> where I have to start /SYS and start /SP/console. How can I auto supply these two commands ? (3 Replies)
Discussion started by: z_haseeb
3 Replies
CRON(8) 						      System Manager's Manual							   CRON(8)

NAME
cron - clock daemon SYNOPSIS
auth/cron [-c] DESCRIPTION
Cron executes commands at specified dates and times according to instructions in the files /cron/user/cron. It runs only on an authentica- tion server. Option -c causes cron to create /cron/user and /cron/user/cron for the current user; it can be run from any Plan 9 machine. Blank lines and lines beginning with # in these files are ignored. Entries are lines with fields minute hour day month weekday host command Command is a string, which may contain spaces, that is passed to an rc(1) running on host for execution. The first five fields are integer patterns for minute 0-59 hour 0-23 day of month 1-31 month of year 1-12 day of week 0-6; 0=Sunday The syntax for these patterns is time : '*' | range range : number | number '-' number | range ',' range Each number must be in the appropriate range. Hyphens specify inclusive ranges of valid times; commas specify lists of valid time ranges. To run the job, cron calls host and authenticates remote execution, equivalent to running rx host command (see con(1)). The user's profile is run with $service set to rx. Cron is not a reliable service. It skips commands if it cannot reach host within two minutes, or if the cron daemon is not running at the appropriate time. EXAMPLES
Here is the job that mails system news. % cat /cron/upas/cron # send system news 15 8-17, 21 *** helix /mail/lib/mailnews % SOURCE
/sys/src/cmd/auth/cron.c SEE ALSO
con(1), rc(1) CRON(8)
All times are GMT -4. The time now is 10:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy