View previous topic :: View next topic |
Author |
Message |
Praxxus Apprentice
Joined: 26 Nov 2002 Posts: 193 Location: Indiana, US
|
Posted: Wed May 21, 2003 8:59 pm Post subject: /etc/init.d/pants . . . now with ebuild! |
|
|
I stumbled across this script through ThinkGeek's Fortunes page, and it amused me.
I have hacked it to work on Gentoo, though in order to suppress some of Gentoo's rc script output, it is using /bin/bash as the interpreter instead of /sbin/runscript. I think it still behaves pretty much like a Gentoo init script, though.
I also added a "No Pants $DAY" option, just for fun.
It is recommended that everyone download this script (or ebuild) & put it in your "default" runlevel, lest you catch cold!
Hope some of you get a chuckle out of this.
NEW A "pants" ebuild!"
Just download this file and unpack it into $PORTDIR_OVERLAY/app-misc/ or wherever. This is for those of you who refuse to put anything on your systems that doesn't have an ebuild. It's also for those of you who think typing "emerge pants" is funny.
Also on edit: Tweaked the script some to behave more like the original.
Code: | #!/bin/bash
source /etc/init.d/functions.sh
NUMPROC=`grep -c "^cpu[0-9]" /proc/stat`
PANTLOCK="/var/lock/subsys/pants"
NOPANTS=`/bin/date +%A`
DAY="Thursday"
start() {
if [ "$NOPANTS" == "$DAY" ] ; then
ewarn "It's No Pants $DAY! Woo-hoo!"
if [ -f $PANTLOCK ] ; then
$0 stop
fi
else
einfon "Putting on pants"
if [ "$NUMPROC" -gt "1" ] ; then
echo -n ", one leg at a time"
fi
echo "..."
if [ -f $PANTLOCK ] ; then
/bin/false
eend $?
eerror "Looks like we've still got some old pants on. They'll do."
else
touch $PANTLOCK
eend $?
fi
fi
}
stop() {
if [ -f $PANTLOCK ] ; then
ebegin "Taking off pants"
rm -f $PANTLOCK
eend $?
else
eerror "We're not wearing any pants!"
/bin/false
eend $?
fi
}
restart() {
echo ""
ebegin "Time for a change of pants"
$0 stop
$0 start
eend $?
}
status() {
if [ "$NOPANTS" == "$DAY" ] ; then
ewarn "It's No Pants $DAY! Woo-hoo!"
$0 stop
elif [ -f $PANTLOCK ] ; then
einfo "Pants are ON . . . "
else
eerror "We're not wearing any pants!"
eend 1
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*|"")
einfo "Acceptable uses for pants: $0 {start|stop|restart|status}"
esac
exit 0 |
_________________ My glaucoma just got worse!
Last edited by Praxxus on Thu May 22, 2003 6:38 pm; edited 4 times in total |
|
Back to top |
|
|
nrl Guru
Joined: 27 Mar 2003 Posts: 446 Location: Glasgow, UK
|
Posted: Wed May 21, 2003 9:11 pm Post subject: |
|
|
Code: |
# /etc/init.d/pants start
* Putting on pants... [ ok ]
# /etc/init.d/pants start
* Looks like we've still got some old pants on. They'll do....
#
|
btw I could not get what you posted to work but messed about with the one from the link you gave.
When I run what you posted I get:
Code: |
# /etc/init.d/pants start
/etc/init.d/pants: line 68: syntax error near unexpected token `)'
/etc/init.d/pants: line 68: ` *)'
|
Last edited by nrl on Wed May 21, 2003 9:47 pm; edited 2 times in total |
|
Back to top |
|
|
Praxxus Apprentice
Joined: 26 Nov 2002 Posts: 193 Location: Indiana, US
|
Posted: Wed May 21, 2003 9:22 pm Post subject: |
|
|
Yup. My posted code had gotten out of sync with the script (I added the "*)" option as I was posting the message), and I forgot the ";;" after "status."
Thanks! _________________ My glaucoma just got worse! |
|
Back to top |
|
|
guy Apprentice
Joined: 31 Mar 2003 Posts: 286 Location: USA
|
Posted: Wed May 21, 2003 11:27 pm Post subject: |
|
|
what's that smell?... I think it's an ebuild.. |
|
Back to top |
|
|
noff Guru
Joined: 11 Nov 2002 Posts: 388 Location: College Park, Maryland
|
Posted: Thu May 22, 2003 5:39 am Post subject: |
|
|
Woo-hoo! It's No Pants Thursday! _________________ What Larry was saying is that if you make it too easy for programmers, then poor programmers will be able to do things best left to good programmers, and will inevitably do them poorly. Everyone will suffer in the long term as a result." - Tom Chance |
|
Back to top |
|
|
frippz Guru
Joined: 22 Aug 2002 Posts: 460 Location: Sweden
|
Posted: Thu May 22, 2003 9:45 am Post subject: |
|
|
Damn!
I can't get my pants on and I gotta go to a lecture soon...! |
|
Back to top |
|
|
Ralphus Maximus Tux's lil' helper
Joined: 22 Jul 2002 Posts: 148 Location: At Large
|
Posted: Thu May 22, 2003 7:51 pm Post subject: |
|
|
I just loaded this on our main server and showed the boss. I think he needs new pants.
Excellent!
Cheers,
RM _________________ Hero for hire. Dragons rescued, Virgins slain.
You say "Cheesy" like it's a bad thing!
In a society that is drug infested, violence-wracked and polluted by chemical greed, no one has ever died from an overdose of pornography. |
|
Back to top |
|
|
nrl Guru
Joined: 27 Mar 2003 Posts: 446 Location: Glasgow, UK
|
Posted: Thu May 22, 2003 8:01 pm Post subject: |
|
|
Today is no pants thursday so I think I will wait till tommorow to emerge pants . |
|
Back to top |
|
|
Praxxus Apprentice
Joined: 26 Nov 2002 Posts: 193 Location: Indiana, US
|
Posted: Thu May 22, 2003 8:02 pm Post subject: |
|
|
Ahh, but "No Pants $DAY" is easily configurable, right at the top of the init script. So if you're one of those "three day weekend" types, you can make it No Pants Friday instead. _________________ My glaucoma just got worse! |
|
Back to top |
|
|
Oopsz Guru
Joined: 08 Oct 2002 Posts: 340
|
|
Back to top |
|
|
nerdbert l33t
Joined: 09 Feb 2003 Posts: 981 Location: Berlin
|
Posted: Sun Sep 07, 2003 7:19 pm Post subject: |
|
|
is there something wrong about the ebuild or am I missing something?
Code: | --- No package manifest found: /usr/local/portage/app-misc/pants/Manifest
>>> md5 src_uri ;-) pants
>>> Unpacking source...
>>> Unpacking pants to /var/tmp/portage/pants-0.7/work
unpack pants: file format not recognized. Ignoring.
>>> Source unpacked.
>>> Install pants-0.7 into /var/tmp/portage/pants-0.7/image/ category app-misc
install: cannot stat `pants': No such file or directory
man:
prepallstrip:
strip:
>>> Completed installing into /var/tmp/portage/pants-0.7/image/
|
|
|
Back to top |
|
|
solatis Apprentice
Joined: 06 Nov 2002 Posts: 214 Location: University of Twente, The Netherlands
|
Posted: Sun Sep 07, 2003 10:19 pm Post subject: |
|
|
gotta love the "rc-update add pants default" statement _________________ Grtz,
Leon Mergen
http://www.solatis.com/ |
|
Back to top |
|
|
|