Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 285849 Details for
Bug 381451
app-misc/screen - add an init script to run multiple screen instances as a system service
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
misc improvements
screen (text/plain), 2.26 KB, created by
Ilya Dmitrichenko
on 2011-09-08 12:17:13 UTC
(
hide
)
Description:
misc improvements
Filename:
MIME Type:
Creator:
Ilya Dmitrichenko
Created:
2011-09-08 12:17:13 UTC
Size:
2.26 KB
patch
obsolete
>#!/sbin/runscript ># Ilya Dmitrichenko < errordeveloper - at -at- g m a i l -dot- com ># Distributed under the terms of the GNU General Public License v2 > ># Originally written for Gentoo, but should work on other platforms :) ># http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4 > >depend() { > use net debug >} > >start() { > > ## SVCNAME is the name of this file in /etc/init.d/ > ## so one can creat /etc/extra-screens.d/ and put > ## the screenrc files there, then simlink the files > ## /etc/init.d/screen -> /etc/init.d/extra-screens > for SCREENRC in /etc/${SVCNAME}.d/* ; do > > SESSION="$(basename $SCREENRC)" > > ## I don't think there may be a security issue, > ## provided that users will not be have write > ## permission in /etc/screen.d/ and if anyone > ## gained access to mod the session file, they > ## are in already anyhow! > BELONGS="$(stat $SCREENRC --printf=%U)" > > MYSHELL="$(getent passwd $BELONGS | cut -d: -f7)" > > > COMMAND="/usr/bin/screen -- -U -D -m -c ${SCREENRC} -S ${SESSION} -t ${SESSION}" > > ## Why on earth would one write this ??? > #HOMEDIR="$(getent passwd $BELONGS | cut -d: -f6)" > > ebegin "Starting ${SVCNAME} session ${SESSION} for ${BELONGS}" > > PIDFILE="/var/run/${SVCNAME}.${BELONGS}.${SESSION}.pid" > > start-stop-daemon \ > --env TERM="rxvt" \ > --env HOME="~${BELONGS}" \ > --env SHELL="${MYSHELL}" \ > --env SCREEN_SESSION=${SESSION} \ > --user $BELONGS \ > --chdir "~${BELONGS}" \ > --make-pidfile \ > --background \ > --pidfile=${PIDFILE} \ > --exec ${COMMAND} > eend $? > done > > #screen -li || /bin/true >} > >stop() { > > ## Perhaps we should determin this by pidfiles ... > ## but this way is not bad either! > for SCREENRC in /etc/${SVCNAME}.d/* ; do > > SESSION="$(basename $SCREENRC)" > BELONGS="$(stat $SCREENRC --printf=%U)" > > PIDFILE="/var/run/${SVCNAME}.${BELONGS}.${SESSION}.pid" > PROCESS="$(cat ${PIDFILE})" > > if [ -e /proc/${PROCESS}/status ]; then > > grep -i "Name:" /proc/${PROCESS}/status | grep -iq "screen" || continue > > ebegin "Stopping ${SVCNAME} session ${SESSION} for ${BELONGS} (PID: ${PROCESS})" > > ## It will CERTAINly kill the righ screen! > CERTAIN="${PROCESS}.${SESSION}" > env TERM="urxvt" \ > start-stop-daemon \ > --user ${BELONGS} \ > --exec /usr/bin/screen -- -S $CERTAIN -X quit > eend $? > > fi > > rm -f $PIDFILE > > done >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 381451
:
285271
| 285849