I sometimes have used mkfifo for an ad-hoc semaphore. Not because of any particular properties of fifo's -- only because mkfifo /tmp/myfifo fails the second time you run it, unlike touch or echo. It's even pretty portable. Cheap and ugly but effective.
If the shell itself had any sort of syntax for O_EXCL it wouldn't be necessary.
Last edited by Corona688; 11-25-2013 at 04:39 PM..
how can I lock my keyboard while I'm away from the computer without using lock command. What other commands gives me the option to lock keyboard device?
thanks (7 Replies)
Hi,
My requirement is to service a process and below is the script which i wrote for that and works fine, I have kept it in a crontab and running this everyminute, how do I lock this if its already running and i dont want to open if its running and not completed yet.
The crontab need to run... (4 Replies)
Hello all,
If anyone has time, I have a few questions:
How do I do the following in Linux. We are using Red Hat and Oracle Enterprise Linux, which is based on Red Hat too.
1. How to lock the account after a few (like 3) invalid password attempts?
2. How do you lock a screen after 30... (1 Reply)
I am trying to create a script that will take a very large, tab delimited file and then lock accounts.
File headers look like this
id desc server pass sudo lock
test Test user server01 67 no no
"Test user" is under the desc column
Basically if pass column is greater... (5 Replies)
Hi,
I have a ksh shell script that accesses databases to drop and create tables and the script also creates text files.
This shell script is accessed thru a java application that i would like to turn multi-user, but the only way that i can do that is if I can figure out a way to lock the shell... (2 Replies)
Hi all,
I have to test some user priviliges. The goal is to be sure that an unauthorized user can't restart some modules (ssh, mysql etc...).
I'm trying to automate it with a shell script but in same cases I got the syslog broadcast message.
Is there any way to simply get a return code... (3 Replies)
Hi All,
newbie here, is it possible to lock my second script? because my 1st script is still running.
Ex.
1st run : 1st script.sh --> running.....
2nd run : 1st script.sh --> lock because the script is still running..
i don't have any idea how to do it.
Please advise,
Thanks,... (1 Reply)
Hi All,
My requirement is i have a script A.sh .When a person A runs the script A.sh it should get locked and person B should not run the script.
i followed the below code
f_script_lock()
{
process=$1
user=`ps -ef | grep -i "$process" | grep -i 'ksh' | awk '{print $1;}'`
if ; then
... (1 Reply)
Hi,
I am new to perl and have a script to which i want to ensure that no matter how many ever times i execute the script it should execute only once per day. Cronjob is not a safe method as I want to built in capability inside the script. (1 Reply)
Discussion started by: ctrld
1 Replies
LEARN ABOUT SUNOS
mkfifo
mkfifo(1M) System Administration Commands mkfifo(1M)NAME
mkfifo - make FIFO special file
SYNOPSIS
/usr/bin/mkfifo [-m mode] path...
DESCRIPTION
The mkfifo utility creates the FIFO special files named by its argument list. The arguments are taken sequentially, in the order specified;
and each FIFO special file is either created completely or, in the case of an error or signal, not created at all.
If errors are encountered in creating one of the special files, mkfifo writes a diagnostic message to the standard error and continues with
the remaining arguments, if any.
The mkfifo utility calls the library routine mkfifo(3C), with the path argument is passed as the path argument from the command line, and
mode is set to the equivalent of a=rw, modified by the current value of the file mode creation mask umask(1).
OPTIONS
The following option is supported:
-m mode Sets the file permission bits of the newly-created FIFO to the specified mode value. The mode option-argument will be the same as
the mode operand defined for the chmod(1) command. In <symbolicmode> strings, the op characters + and - will be interpreted rela-
tive to an assumed initial mode of a=rw.
OPERANDS
The following operand is supported:
file A path name of the FIFO special file to be created.
USAGE
See largefile(5) for the description of the behavior of mkfifo when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of mkfifo: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 All the specified FIFO special files were created successfully.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO mkfifo(3C), attributes(5), environ(5), largefile(5), standards(5)SunOS 5.10 16 Sep 1996 mkfifo(1M)