Article View: alt.privacy.anon-server
Article #283443Re: Problem with mixmaster init.d script
From: Anonymous
Date: Fri, 15 Jul 2016 22:47
Date: Fri, 15 Jul 2016 22:47
156 lines
5022 bytes
5022 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Every time I try to run this auto start script, if gets
> this error:
>
> Detaching.
> Could not open pidfile for readwrite: Permission denied
> Aborting.
>
> The problem is that it changes the mixmaster.pid file
> ownership to root:root. Does anyonec see a way around this:
I have been needing to create one of these for myself,
so I rewrote it. It seems to be working ok. The problem
you were having seemed to be with an unnecessary instruction
that was being executed from root that was causing root to
take ownership of the mixmaster.pid file. The below works
when executed directly. I have not tried to see if it will
correctly auto start mixmaster at boot.
#!/bin/sh
#
# Usage: /etc/init.d/mixmaster.sh <start|stop|restart|status>
#
# Name of this program should be: 'mixmaster.sh'. Do not name it 'mixmaster'
# because the 'is_running()' function becomes confused.
# Place the script in the /etc/init.d/ folder.
# Name of the program that this program controls ('mixmaster' in this case)
# should be placed in the 'pgmname' field.
# dir is the path to the 'mixmaster' executable.
# user is the user running 'mixmaster'.
# cmd is the command used to execute 'mixmaster'.
dir="/home/mix/Mix"
cmd="./mixmaster -D"
user="mix"
pgmname="mixmaster"
pid_file="$dir/$pgmname.pid"
stdout_log="/var/log/$pgmname.log"
stderr_log="/var/log/$pgmname.err"
get_pid() {
cat "$pid_file"
}
is_running() {
if pidof -x "$pgmname" >/dev/null; then
return 0
else
return 1
fi}
case "$1" in
start)
if is_running; then
echo "Already started"
else
echo "Starting $pgmname"
cd "$dir"
if [ -z "$user" ]; then
sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
else
sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
fi
if ! is_running; then
for i in {1..10}; do
if is_running; then
echo ""
echo "Started!"
break
fi
echo -n "."
sleep 1
done
fi
if ! is_running; then
echo "Unable to start, see $stdout_log and $stderr_log"
exit 1
fi
fi
;;
stop)
if is_running; then
echo -n "Stopping $pgmname.."
kill `get_pid`
for i in {1..10}; do
if ! is_running; then
echo ""
break
fi
echo -n "."
sleep 1
done
echo
if is_running; then
echo "Not stopped - may still be shutting down or shutdown may have failed."
exit 1
else
echo "Stopped!"
fi
else
echo "Not running."
fi
;;
restart)
$0 stop
if is_running; then
echo "Unable to stop, will not attempt to restart."
exit 1
fi
$0 start
;;
status)
if is_running; then
echo "Running!"
else
echo "Stopped!"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
-----BEGIN PGP SIGNATURE-----
iQIcBAEBAgAGBQJXiVbxAAoJEInjXwVU+GB4XT0QAIFkFxKXf/9zzpnTMevYo99l
REz+N8WI0jkHQOA2QOrQrkW9b91dJJZiaQNptG958gJ03ugK1t6Zyx7JeLVi9ZRZ
zeXSJIMB7ejLuIQvoE9g/lZihumzgUaxSEa6HUgt9UYDeHc2t6mE6BP5qefEIaB4
mMV2I3NO6HvVwIE1+hmBF5aOrHpRtBUgolApMpl1VEY6M5+ruumPEv2gujwIZcIT
c8HH6K5Nlzl4V+i79B6Llsvq6AnbPLVY4wI4uXT3mlGhhrDjXzt71ij0xEcnDBiy
3GtLwfO70V6NtOxUsUdzGjKuSp9vIThpvjiwL2YNJAcnRL9craj8nQeACSyJuZxp
4xp6b8dLXTYYOJOCCZ+fDGnUv1xbst6GwMDRKn736Yg070szhPHhX6pvEnMkaMV2
16Ut//N2sz9dvEC6i54XErtLmJMxJX9N9kY+FsEuTaEUmb7031hwDCii0CkY3LO3
SemaEA38ZqFcdd/Q37gomnaFxb2jfJTEIeKAcSwKGBuvJ8lMlWpREBYPZhvU62yp
U1m39ftxHl3Bigh0c4gz/IvcBZ8EocGKj8j8EIhT4pSmoqYDnfc7Q8ike2Z9tBlN
BJMFHBCRMQ37K6vcbwoZvsgYjM0DPDFove4KElO8BvOzMqDncnNTUea0J90D5gIG
yoXY/NspahV1X/9LpHw6
=fFq7
-----END PGP SIGNATURE-----
inwtx.net
Technical Details
Message-ID:
<b0e384f3c0d767dc1a10457ec02c4f3c@foto.nl1.torservers.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!news.usenet.farm!..!..!not-for-mailReferences:
<dcf85fb725e312f809330493f1769051@remailer.privacy.at>Show Full Headers
Complete Article Headers
Message-ID: <b0e384f3c0d767dc1a10457ec02c4f3c@foto.nl1.torservers.net> Subject: Re: Problem with mixmaster init.d script Date: Fri, 15 Jul 2016 22:47:22 +0000 From: Anonymous <anonymous@foto.nl1.torservers.net> References: <dcf85fb725e312f809330493f1769051@remailer.privacy.at> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!news.usenet.farm!..!..!not-for-mail Comments: This message did not originate from the Sender address above. It was remailed automatically by anonymizing remailer software. Please report problems or inappropriate use to the remailer administrator at <abuse@foto.nl1.torservers.net>. Newsgroups: alt.privacy.anon-server Injection-Info: mail2news.mixmin.net; mail-complaints-to=abuse@mixmin.net Lines: 156