thx for reply.
This script is really basic here there's the section I was talking about:
so at the end if RC is equal to zero means that all return codes were equal to the expected ones.
One pratical example that doesn't work is the command:
Quote:
service syslog restart
if an unauthorized user try to execute that command I got back the message:
Quote:
Shutting down kernel logger: /etc/init.d/functions: line 141: /var/run/klogd.pid: Permission denied
rm: cannot remove `/var/run/klogd.pid': Permission denied [FAILED]
Shutting down system logger: /etc/init.d/functions: line 141: /var/run/syslogd.pid: Permission denied
rm: cannot remove `/var/run/syslogd.pid': Permission denied[FAILED]
rm: cannot remove `/var/lock/subsys/syslog': Permission denied
Starting system logger: /etc/init.d/functions: line 141: /var/run/syslogd.pid: Permission denied
And the script stop its execution. To get the prompt back I have to type Ctrl-C.
The problem for me is that I would like simply to get back the return code to comprare with the expected one.
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 all
I need help finding a process that is continuing to create files in the above area. There are three sub folder titled addr q.local and msg . I have already found a process called mmdf running and have used the kill command to stop this from running. I have also looked for sendmail or... (12 Replies)
Hi ,
How should i implemet a lock function Hp-ux .
I want to a lock a file through fcntl in Hp-ux .
But is not locking properly .
Thanks
Narendra (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)
please tell pre-requisite steps to activate cron. i activated the cron but it not executing the script which i set in crontab entry.through root user i passed the service crond start it get start.but when i go to etc/init.d and passed crond stop command.it gets crond: can't lock /var/run/crond.pid,... (2 Replies)
I'm not able to view my inbox mails, I'm using Thunderbird.
I have checked the /var/mail/ directory files. There I saw the lock file. .
I have removed the lock file and restarted the Thunderbird, again the lock file is created.
I have changed the file group as mail from users. after that... (1 Reply)
Hello
I have simple line of code here:
FILE *lockfp = fopen("/var/lock/subsys/processName", "w");
which is denied even running as root. The result is
locking failed for the following reason: Permission denied
How is this possible? Why is this happening?
Thanks for your... (4 Replies)
I am getting error on redis server on linux 7.5 after change the default path /var/lib/redis to /redisdata, and enable cluster-enabled yes. It would be really appreciate if some one can check and suggest on this issue.
error code:
1240:C 09 Sep 2018 13:53:51.058 # oO0OoO0OoO0Oo Redis is... (3 Replies)
Discussion started by: nadeemrafikhan
3 Replies
LEARN ABOUT CENTOS
mailunlock
MAILOCK(3) Linux Programmer's Manual MAILOCK(3)NAME
maillock, mailunlock, touchlock - manage mailbox lockfiles
SYNOPSIS
#include <maillock.h>
cc [ flag ... ] file ... -llockfile [ library ]
int maillock( const char *user, int retrycnt );
void mailunlock( void );
void touchlock( void );
DESCRIPTION
The maillock function tries to create a lockfile for the users mailbox in an NFS-safe (or resistant) way. The algorithm is documented in
lockfile_create(3).
The mailbox is typically located in /var/mail. The name of the lockfile then becomes /var/mail/USERNAME.lock. If the environment variable
$MAIL is set, and it ends with the same username as the username passed to maillock(), then that file is taken as the mailbox to lock
instead.
There is no good way to see if a lockfile is stale. Therefore if the lockfile is older then 5 minutes, it will be removed. That is why the
touchlock function is provided: while holding the lock, it needs to be refreshed regulary (every minute or so) by calling touchlock () .
Finally the mailunlock function removes the lockfile.
RETURN VALUES
maillock returns one of the following status codes:
#define L_SUCCESS 0 /* Lockfile created */
#define L_NAMELEN 1 /* Recipient name too long (> 13 chars) */
#define L_TMPLOCK 2 /* Error creating tmp lockfile */
#define L_TMPWRITE 3 /* Can't write pid int tmp lockfile */
#define L_MAXTRYS 4 /* Failed after max. number of attempts */
#define L_ERROR 5 /* Unknown error; check errno */
NOTES
These functions are not thread safe. If you need thread safe functions, or you need to lock other mailbox (like) files that are not in the
standard location, use lockfile_create(3) instead.
These functions call lockfile_create(3) to do the work. That function might spawn a set group-id executable to do the actual locking if the
current process doesn't have enough priviliges.
There are some issues with flushing the kernels attribute cache if you are using NFS - see the lockfile_create(3) manpage.
FILES
/var/mail/user.lock,
/usr/lib/liblockfile.so.1
AUTHOR
Miquel van Smoorenburg <miquels@cistron.nl>
SEE ALSO lockfile_create(3), lockfile_touch (3), lockfile_remove(3)Linux Manpage 28 March 2001 MAILOCK(3)