Sponsored Content
Full Discussion: Cronjob Activation
Top Forums Shell Programming and Scripting Cronjob Activation Post 302167183 by Smiling Dragon on Wednesday 13th of February 2008 05:16:44 PM
Old 02-13-2008
Quote:
Originally Posted by Raynon
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?
Because one copy is running, the one that's currently executing. It's looking for another version of itself (ie 2 or more) in case there are other copies still running.
Quote:
Originally Posted by Raynon
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 ".
Works for me, when I run a csh script with a sleep in it, I see the sleep, _and_ the main script running.
 

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
SYSPROFILE(8)						      System Manager's Manual						     SYSPROFILE(8)

NAME
sysprofile - modular centralized shell configuration DESCRIPTION
sysprofile is a generic approach to configure shell settings in a modular and centralized way mostly aimed at avoiding work for lazy sysad- mins. It has only been tested to work with the bash shell. It basically consists of the small /etc/sysprofile shell script which invokes other small shell scripts having a .bash suffix which are contained in the /etc/sysprofile.d/ directory. The system administrator can drop in any script he wants without any naming convention other than that the scripts need to have a .bash suffix to enable automagic sourcing by /etc/sysprofile. This mechanism is set up by inserting a small shell routine into /etc/profile for login shells and optionally into /etc/bashrc and/or /etc/bash.bashrc for non-login shells from where the actual /etc/sysprofile script is invoked: if [ -f /etc/sysprofile ]; then . /etc/sysprofile fi For using "sysprofile" under X11, one can source it in a similar way from /etc/X11/Xsession or your X display manager's Xsession file to provide the same shell environment as under the console in X11. See the example files in /usr/share/doc/sysprofile/ for illustration. For usage of terminal emulators with a non-login bash shell under X11, take care to enable sysprofile via /etc/bash.bashrc. If not set this way, your terminal emulators won't come up with the environment defined by the scripts in /etc/sysprofile.d/. Users not wanting /etc/sysprofile to be sourced for their environment can easily disable it's automatic mechanism. It can be disabled by simply creating an empty file called $HOME/.nosysprofile in the user's home directory using e.g. the touch(1) command. Any single configuration file in /etc/sysprofile.d/ can be overridden by any user by creating a private $HOME/.sysprofile.d/ directory which may contain a user's own version of any configuration file to be sourced instead of the system default. It's names have just to match exactly the system's default /etc/sysprofile.d/ configuration files. Empty versions of these files contained in the $HOME/.syspro- file.d/ directory automatically disable sourcing of the system wide version. Naturally, users can add and include their own private script inventions to be automagically executed by /etc/sysprofile at login time. OPTIONS
There are no options other than those dictated by shell conventions. Anything is defined within the configuration scripts themselves. SEE ALSO
The README files and configuration examples contained in /etc/sysprofile.d/ and the manual pages bash(1), xdm(1x), xdm.options(5), and wdm(1x). Recommended further reading is everything related with shell programming. If you need a similar mechanism for executing code at logout time check out the related package syslogout(8) which is a very close compan- ion to sysprofile. BUGS
sysprofile in its current form is mainly restricted to bash(1) syntax. In fact it is actually a rather embarrassing quick and dirty hack than anything else - but it works. It serves the practical need to enable a centralized bash configuration until something better becomes available. Your constructive criticism in making this into something better" is very welcome. Before i forget to mention it: we take patches... ;-) AUTHOR
sysprofile was developed by Paul Seelig <pseelig@debian.org> specifically for the Debian GNU/Linux system. Feel free to port it to and use it anywhere else under the conditions of either the GNU public license or the BSD license or both. Better yet, please help to make it into something more worthwhile than it currently is. SYSPROFILE(8)
All times are GMT -4. The time now is 04:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy