![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Newbie
Join Date: Jul 2005
Posts: 10
Rep Power: 0
![]() |
Will that file contain login information of NIS clients also?
|
|
|
|
|
|
#12 |
|
Programmer
Join Date: Feb 2005
Posts: 54
Rep Power: 4
![]() |
I'm not sure, what does the man page say? You could run a little test. When you know there are some NIS clients logged in, run the "who" program. It does exactly what I suggested, it reads the utmp file and prints the users.
Also, your daemon will not need to be a superuser to read this file, which will make it more secure. The last thing you want to do is open a hole in an important machine. |
|
|
|
|
|
#13 |
|
Newbie
Join Date: Jul 2005
Posts: 2
Rep Power: 0
![]() |
Hello Dear
I am using CetOS4.0 and trying to create an init.d script for my python script. It is working fine if i have only one python script running as daemon. If i run multiple daemons then the problem is "pidof" command. Which returns the pids of all Python programs. I want to run few Python daemon on machine. I also tried using daemon $prog 2>&1 > /dev/null & echo $! > $pidfile but this return the pidof "daemon" rather than returning the PID of python script, in later case it also starts syslogger which i do not want to get executed with default setting. Need hellp urgently. Please provide some clue. Manjeet Chaudhary |
|
|
|
|
|
#14 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
I'm under the assumption you're running your script by making it executable and placing the path to the Python interpreter on the top line, prefixed by a hash and an exclamation mark (e.g #!/usr/bin/python), and then calling it directly? You're not running `python myscript.py`, yes?
|
|
|
|
|
|
#15 |
|
Newbie
Join Date: Jul 2005
Posts: 2
Rep Power: 0
![]() |
Hello Cerulean
My init.d startup script is shell script and it is executable. Added the script in startup. I am calling the Python script using command "python /path_to_server_script" from the init.d scrip. In the server script i am using #!/usr/bin/env python; which i think is not required. The server script opens a port and keeps listening for req. I am attaching the init.d script. Please check out and suggest. Thank you. My startup script is ... ------------- # pidfile: /var/run/server_script.pid # config: # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 RETVAL=0 pidfile="/var/run/server_script.pid" lockfile="/var/lock/subsys/server_script" name="server_script" prog="python /opt/pkg/server_script.py" start() { #--------Check if server is already running if [ -f $pidfile ]; then pid=cat $pidfile if [ ]ps -elf touch $pidfile touch $lockfile echo -n "$name (pid `cat $pidfile`) is Running." && success echo exit 0 fi echo -n $"Starting $name: " $prog& 2>&1 > /dev/null #--------Check for the success if [ -z "`/sbin/pidof $prog`" ]; then failure $"$prog startup" RETVAL=1 else pidofproc $prog > $pidfile && touch $lockfile && success $"$prog startup" RETVAL=0 fi echo return $RETVAL } stop() { echo -n $"Stopping $name: " killproc server_script RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile && rm -f $pidfile return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; status) #--------Check status if [ -n "`/sbin/pidof $prog`" ]; then pidofproc $prog > $pidfile touch $lockfile echo "$name (pid `cat $pidfile`) is Running." else echo "$name is not running." RETVAL=3 fi ;; *) echo $"Usage: $0 {start|status|stop|restart|reload}" exit 1 esac exit $RETVAL ---------------- |
|
|
|
|
|
#16 | |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|