Sponsored Content
Full Discussion: Cronjob Activation
Top Forums Shell Programming and Scripting Cronjob Activation Post 302166858 by Raynon on Wednesday 13th of February 2008 01:52:38 AM
Old 02-13-2008
Hi ,

I am refering to this particular exmaple that you have provided me.

Code:
#!/bin/csh
set numprocs=`ps -ef | grep -v grep | grep $scriptname | wc -l | awk '{ print $1 }'`
if ($numprocs == 1) then
    # carry on
else
   echo "Another instance is already running, exiting..."
   exit 0
endif

What is the significance of the numprocs?
If it equals to 1 , why does it show that the script is not running anymore?

I tried a simple csh script below and it doesn;t really work.
When it is sleeping, the name of the script which is "myscriptname" is not reflected during " ps -ef ", it only shows " usr 28951 28941 0 15:00:39 pts/7 0:00 sleep 100 ".

Can you help ?

Code:
#!/bin/csh

echo xxx
echo ppp 
echo zzz

sleep 100

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Wireless ipw2200 activation

hello ! i am trying to activate my wireless network card on my laptop currently running : 2.6.18-1.2869.fc6 , but an error msg appears "ipw2200 device eth1 does not seem to be present, delaying initialization." the same msg also appears at the start up process, when trying to bring up eth1. ... (4 Replies)
Discussion started by: XinU*
4 Replies

2. Forum Support Area for Unregistered Users & Account Problems

Did not receive activation mail

Hi Administrators, I've registered myself yesterday and have been waiting for my account to be activated. I've followed the instructions in the 'See this if you have an account but cannot post ' thread to request for an activation mail to be sent to my other email address, but still did not... (0 Replies)
Discussion started by: pl_cyber
0 Replies

3. Forum Support Area for Unregistered Users & Account Problems

Account Activation Problem

Hi, I got the username and activation code to my email id but when i click on the forum link and enter the activation code and username there then , It displays "We could not activate your account because this web address is not valid. Make sure that you have the entire address from the... (1 Reply)
Discussion started by: MIKU
1 Replies

4. Forum Support Area for Unregistered Users & Account Problems

Activation

can't activate (0 Replies)
Discussion started by: jamalwil7
0 Replies

5. Forum Support Area for Unregistered Users & Account Problems

Please send activation mail..

Hi, I have registered your site and i havent received any activation mail. please send me activation mail. Thanks & Regards, BVIJAY (1 Reply)
Discussion started by: bvijaycom
1 Replies

6. Forum Support Area for Unregistered Users & Account Problems

I need another activation email

Hi neo I registered yesterday,but i don't receive the activation email,can u send again? thanks! (1 Reply)
Discussion started by: swrd
1 Replies

7. Forum Support Area for Unregistered Users & Account Problems

Still waiting for activation email

Hi, I've been waiting for about 2 hours to receive my activation email but it hasn't arrived yet. I followed the 'resend activation information' link so I'm now expecting 2 activation emails, neither has arrived yet. How long do I expect this to take? I've tested my email account from other... (2 Replies)
Discussion started by: cambridge
2 Replies

8. Forum Support Area for Unregistered Users & Account Problems

Activation problems with new account.

I received the email describing how to acivate my new account (I'm using Outlook 2007). I tried clicking the URL given and was told "invalid web address". I tried copying and pasting both URL's - "invalid web address. Lastly, I tried typing in the URL - "invalid web address". There were no spaces... (1 Reply)
Discussion started by: ki6bxp
1 Replies

9. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

10. Forum Support Area for Unregistered Users & Account Problems

Not able to post after activation

Hi... I got my account created and after activation I'm not able to create new posts or start a new thread. Can you help on how to start a new thread? Thanks. (1 Reply)
Discussion started by: Bang3095
1 Replies
wait(1)                                                            User Commands                                                           wait(1)

NAME
wait - await process completion SYNOPSIS
/bin/sh wait [pid...] /bin/jsh /bin/ksh /usr/xpg4/bin/sh wait [pid...] wait [ % jobid...] /bin/csh wait DESCRIPTION
The shell itself executes wait, without creating a new process. If you get the error message cannot fork,too many processes, try using the wait command to clean up your background processes. If this doesn't help, the system process table is probably full or you have too many active foreground processes. There is a limit to the number of process IDs associated with your login, and to the number the system can keep track of. Not all the processes of a pipeline with three or more stages are children of the shell, and thus cannot be waited for. /bin/sh, /bin/jsh Wait for your background process whose process ID is pid and report its termination status. If pid is omitted, all your shell's currently active background processes are waited for and the return code will be 0. The wait utility accepts a job identifier, when Job Control is enabled (jsh), and the argument, jobid, is preceded by a percent sign (%). If pid is not an active process ID, the wait utility will return immediately and the return code will be 0. csh Wait for your background processes. ksh When an asynchronous list is started by the shell, the process ID of the last command in each element of the asynchronous list becomes known in the current shell execution environment. If the wait utility is invoked with no operands, it will wait until all process IDs known to the invoking shell have terminated and exit with an exit status of 0. If one or more pid or jobid operands are specified that represent known process IDs (or jobids), the wait utility will wait until all of them have terminated. If one or more pid or jobid operands are specified that represent unknown process IDs (or jobids), wait will treat them as if they were known process IDs (or jobids) that exited with exit status 127. The exit status returned by the wait utility will be the exit status of the process requested by the last pid or jobid operand. The known process IDs are applicable only for invocations of wait in the current shell execution environment. OPERANDS
The following operands are supported: One of the following: pid The unsigned decimal integer process ID of a command, for which the utility is to wait for the termination. jobid A job control job ID that identifies a background process group to be waited for. The job control job ID notation is applicable only for invocations of wait in the current shell execution environment, and only on systems supporting the job control option. USAGE
On most implementations, wait is a shell built-in. If it is called in a subshell or separate utility execution environment, such as one of the following, (wait) nohup wait ... find . -exec wait ... ; it will return immediately because there will be no known process IDs to wait for in those environments. EXAMPLES
Example 1: Using A Script To Identify The Termination Signal Although the exact value used when a process is terminated by a signal is unspecified, if it is known that a signal terminated a process, a script can still reliably figure out which signal is using kill, as shown by the following (/bin/ksh and /usr/xpg4/bin/sh): sleep 1000& pid=$! kill -kill $pid wait $pid echo $pid was terminated by a SIG$(kill -l $(($?-128))) signal. Example 2: Returning The Exit Status Of A Process If the following sequence of commands is run in less than 31 seconds (/bin/ksh and /usr/xpg4/bin/sh): sleep 257 | sleep 31 & jobs -l %% then either of the following commands will return the exit status of the second sleep in the pipeline: wait <pid of sleep 31> wait %% ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of wait: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), jobs(1), ksh(1), sh(1), attributes(5), environ(5), standards(5) SunOS 5.10 12 Dec 1997 wait(1)
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy