You could try using a .pid file and check it at the top of your script like this:
All designs that try to check for a lock-file or pid-file are flawed. They are subjective to racecondition
The problem is that you can not check for the existence of a file and the creation of that file in an atomic action. And in between of those two actions another instance can run.
Hi,
I am writing a shell script to invoke a C++ program. Before I start the C++ program (oi7loadbalancer), I am checking if the process is already running. I start the process only if it is not already running. I have the following check in my script.
proccount=`ps -f -u $USER_NAME | grep... (8 Replies)
Alright, I think I know what I am doing with sed(which probably means I don't). But I cant figure out how to replace just the first occurance of a string. I have tried sed, ed, and grep but can't seem to figure it out. If you have any suggestions I am open to anything! (3 Replies)
Hi,
PHP user here. I'm using an endless loop to perform to mimic a cron. The script does something every 20 minutes. It sleep()s in the meantime.
I have various checks that ensure that only instance can run, including a "gentleman agreement" locked file.
However, I'd like to make sure... (2 Replies)
Hello.
I have a status command in AIX box, which provides output as below:
$ status
You are running the application on pegasus2
----Program Name------|--Avail / Total---------|
MQ | 1/2 |
ORACLE | 10/10 |
TMADMIN ... (3 Replies)
Hi All,
After reading that the sort command in Linux can be made to use many processor cores just by using a simple script which I found on the internet, I was wondering if I can use similar techniques for programs like the awk and sed?
#!/bin/bash
# Usage: psort filename <chunksize>... (7 Replies)
I have run 10 instances of the process eg, process name is BG
nohup /WP01IRB1_irbapp/IRBWPROD/RB/bin/BG -c 1 -t 23 -a '-caTop TESTBILLCYCLE='5FEB13_81PT19NPT''>a.txt &
nohup /WP01IRB1_irbapp/IRBWPROD/RB/bin/BG -c 2 -t 23 -a '-caTop TESTBILLCYCLE='5FEB13_81PT19NPT''>b.txt &
nohup... (3 Replies)
Hi,
I want to write one program in C in Unix OS which will check the running status of a process time to time. If the process is stopped somehow by any means, it will ensure that the process is restarted and only one copy of the process image should run in memory at any point of time for the user.... (2 Replies)
Hello All,
Greetings !!
I have a query here to all is as follows:
Question: Let's say we are running a script in a UNIX box and we have opened an another session and then made changes in script of some statements NOT to be print some values(just an example) so when I am monitoring the... (5 Replies)
Hi Guys,
I have a main_script.sh which runs every day and scheduled in crontab.
in the main script i read data from config file
test.config
apple
mango
orange
main_script.sh
for i in `cat test.config`
do
if
then
echo 'Apple' (3 Replies)
Discussion started by: Master_Mind
3 Replies
LEARN ABOUT NETBSD
screenblank
SCREENBLANK(1) BSD General Commands Manual SCREENBLANK(1)NAME
screenblank -- screen saver daemon for wscons and FBIO machines
SYNOPSIS
screenblank [-k | -m] [-d inactivity-timeout] [-e wakeup-delay] [-f framebuffer] [-i input-device]
screenblank {-b | -u}
DESCRIPTION
screenblank disables the framebuffer if the keyboard and mouse are idle for a period of time, and re-enables the framebuffer when keyboard or
mouse activity resumes.
When killed with a SIGINT, SIGHUP, or SIGTERM, screenblank will re-enable the framebuffer. The pid can be found in the file
/var/run/screenblank.pid.
The options are as follows:
-b Overriding the other options, simply try (once) to blank the framebuffer, then exit.
-d inactivity-timeout
Wait the number of seconds specified by inactivity-timeout, expressed in the format ``xxx.xxx'', before disabling the framebuffer due
to inactivity. The default is 600 seconds (10 minutes).
-e wakeup-delay
Wait the number of seconds specified by wakeup-delay, expressed in the format ``xxx.xxx'', before re-enabling the framebuffer once
activity resumes. The default is .25 seconds.
-f framebuffer
Use the framebuffer device framebuffer instead of the default /dev/fb.
-i input-device
Add input-device to the list of devices to monitor for activity.
-k Do not check the keyboard for activity.
-m Do not check the mouse for activity.
-u Overriding the other options, simply try (once) to unblank the framebuffer, then exit.
Note that the -k and -m flags are mutually exclusive.
FILES
/dev/kbd The keyboard device.
/dev/mouse The mouse device.
/dev/console The console device.
/dev/fb The default framebuffer.
/dev/wskbd The keyboard for wscons machines.
/dev/wsmouse The mouse device for wscons machines.
/dev/ttyE0 The console device for wscons machines.
/var/run/screenblank.pid File containing the pid of screenblank.
BSD September 23, 2006 BSD