diff options
| author | Luke Kanies <luke@madstop.com> | 2005-04-13 15:23:57 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-04-13 15:23:57 +0000 |
| commit | 5416017c05e44fc635ad14ffdf1ac1163a4cc6e5 (patch) | |
| tree | 29a33a7dd1389abde8d92219a17beead01ba1f47 /examples/root | |
| parent | 54e9b5e3561977ea063417da12c46aad2a4c1332 (diff) | |
| download | puppet-5416017c05e44fc635ad14ffdf1ac1163a4cc6e5.tar.gz puppet-5416017c05e44fc635ad14ffdf1ac1163a4cc6e5.tar.xz puppet-5416017c05e44fc635ad14ffdf1ac1163a4cc6e5.zip | |
reorganizing
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@95 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'examples/root')
| -rwxr-xr-x | examples/root/bin/sleeper | 97 | ||||
| -rw-r--r-- | examples/root/etc/configfile | 0 | ||||
| -rwxr-xr-x | examples/root/etc/init.d/sleeper | 25 |
3 files changed, 122 insertions, 0 deletions
diff --git a/examples/root/bin/sleeper b/examples/root/bin/sleeper new file mode 100755 index 000000000..6c1495928 --- /dev/null +++ b/examples/root/bin/sleeper @@ -0,0 +1,97 @@ +#!/usr/bin/perl -w + +### +# sleep indefinitely as a debug + +use strict; +use Getopt::Long; +use Pod::Usage; + +#----------------------------------------------------------------- +sub daemonize +{ + use POSIX 'setsid'; + $| = 1; + chdir '/' or die "Can't chdir to /: $!\n"; + open STDIN, "/dev/null" or die "Can't read /dev/null: $!\n"; + open STDOUT, "> /dev/null" or die "Can't write to /dev/null: $!\n"; + defined(my $pid = fork()) or die "Can't fork: $!\n"; + #print STDERR $pid, "\n"; + exit if $pid; + setsid or die "Can't start a new session: $!\n"; + open STDERR, ">&STDOUT" or die "Can't dup stdout: $!\n"; +} +#----------------------------------------------------------------- + +my ($help,$opt_result,$debug,$fun); + +$opt_result = GetOptions +( + "help" => \$help, + "debug" => \$debug, + "fun" => \$fun, +); + +if (! $opt_result) +{ + pod2usage('-exitval' => 1, '-verbose' => 0); + exit(1); +} + +if ($help) +{ + pod2usage('-exitval' => 1, '-verbose' => 2); + exit; +} + +unless ($debug) { + daemonize(); +} + +while(1){ + sleep 600; +} + +=head1 NAME + +template - this is a template script and should be copied and modded + +=head1 SYNOPSIS + +template [-help] + +=head1 DESCRIPTION + +B<template> is a stub script. + +=head1 OPTIONS + +=over 4 + +=item help + +Prints out help page. + +=back + +B<Example> + +template + +=head1 BUGS + +This script shouldn't be modified, or has apparently not been documented. + +=head1 SEE ALSO + +L<Cat> + +=head1 AUTHOR + +Luke A. Kanies, luke.kanies@cat.com + +=for html <hr> + +I<$Id$> + +=cut diff --git a/examples/root/etc/configfile b/examples/root/etc/configfile new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/examples/root/etc/configfile diff --git a/examples/root/etc/init.d/sleeper b/examples/root/etc/init.d/sleeper new file mode 100755 index 000000000..7a6614087 --- /dev/null +++ b/examples/root/etc/init.d/sleeper @@ -0,0 +1,25 @@ +#! /bin/sh + +PATH=$PATH:/home/luke/svn/blink/examples/root/bin + +case "$1" in + start) + sleeper + ;; + stop) + kill `ps -ef | grep -v grep | grep sleeper | grep perl | awk '{print $2}'` + ;; + status) + if sh -c "ps -ef | grep -v grep | grep -v init.d | grep sleeper"; then + exit 0 + else + exit 1 + fi + ;; + *) + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |
