This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
howtos:linux [2007/01/24 09:41] – manni | howtos:linux [2007/01/24 14:53] – manni | ||
---|---|---|---|
Line 3: | Line 3: | ||
All of the information below assumes you are logged in as root. | All of the information below assumes you are logged in as root. | ||
- | Here is a script for RedHat- it needs to reside in /// | + | Here is a script for %%RedHat%%- it needs to reside in /// |
It is based on a script by John Zoetebier for SuSE (The HOWTO forum has the original [[http:// | It is based on a script by John Zoetebier for SuSE (The HOWTO forum has the original [[http:// | ||
Line 12: | Line 12: | ||
you will also need to make a symbolic link (see below) in /// | you will also need to make a symbolic link (see below) in /// | ||
- | you make the link as follows:< | + | you make the link as follows: |
- | ln -s / | + | < |
- | </ | + | |
and | and | ||
Line 33: | Line 32: | ||
which makes it executable by everyone (all, group, user). If you only want root to run the script, then use: | which makes it executable by everyone (all, group, user). If you only want root to run the script, then use: | ||
- | < | + | < |
+ | < | ||
+ | #--- SCRIPT START file called: popfile | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # Copyright (C) 2003 John Zoetebier < | ||
+ | # | ||
+ | # This program is free software; you can redistribute it and/or | ||
+ | # modify it under the terms of the GNU General Public License | ||
+ | # as published by the Free Software Foundation; either | ||
+ | # version 2 of the License, or (at your option) any later | ||
+ | # version. | ||
+ | # | ||
+ | # This program is distributed in the hope that it will be useful, | ||
+ | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
+ | # GNU General Public License for more details. | ||
+ | # | ||
+ | # You should have received a copy of the GNU General Public License | ||
+ | # along with this program; if not, write to the Free Software | ||
+ | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
+ | # | ||
+ | # ============== | ||
+ | # History | ||
+ | # -------------- | ||
+ | # Modified by Peter Davie to include RedHat specific featues (e.g. using the ' | ||
+ | # 19 Nov 2003 10:49am MYT | ||
+ | # | ||
+ | # | ||
+ | # popfile | ||
+ | # | ||
+ | # A shell-script wrapper for popfile designed for use in the SysV-init | ||
+ | # system (/ | ||
+ | # | ||
+ | # | ||
+ | # usage: popfile { start | stop | restart | } | ||
+ | # | ||
+ | # See also: LSB, start_daemon (lsb), startproc (suse), install_initd (lsb), | ||
+ | # insserv (suse), / | ||
+ | # | ||
- | ---- SCRIPT START file called: popfile | + | ## |
- | | + | # RedHat comment block... |
- | - | + | # |
- | - Copyright (C) 2003 John Zoetebier < | + | # chkconfig: 345 80 20 |
- | - | + | # description: |
- | - This program is free software; you can redistribute it and/or | + | # pidfile: /var/run/popfile.pid # processname: popfile |
- | - modify it under the terms of the GNU General Public License | + | # |
- | - as published by the Free Software Foundation; either | + | # |
- | - version 2 of the License, or (at your option) any later | + | |
- | - version. | + | |
- | - | + | |
- | - This program | + | |
- | - but WITHOUT ANY WARRANTY; without even the implied warranty of | + | |
- | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | + | |
- | - GNU General Public License for more details. | + | |
- | - | + | |
- | - You should have received | + | |
- | - along with this program; if not, write to the Free Software | + | |
- | - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | + | |
- | - | + | |
- | - ============== | + | |
- | - History | + | |
- | - -------------- | + | |
- | - Modified by Peter Davie to include RedHat specific featues (e.g. using the ' | + | |
- | - 19 Nov 2003 10:49am MYT | + | |
- | - | + | |
- | - | + | |
- | - popfile | + | |
- | - | + | |
- | - A shell-script wrapper for popfile designed for use in the SysV-init | + | |
- | - system (/etc/init.d). | + | |
- | - | + | |
- | - | + | |
- | - usage: popfile | + | |
- | - | + | |
- | - See also: LSB, start_daemon (lsb), startproc (suse), install_initd (lsb), | + | |
- | - insserv (suse), / | + | |
- | - | + | |
- | - | + | ## |
- | - RedHat | + | # LSB comment block... |
- | - | + | # |
- | - chkconfig: 345 80 20 | + | # The bogus 345 run-levels are a workround for a buggy RedHat |
- | - description: popfile is a POP3 proxy and mail filter | + | # reads the LSB comment block (incorrectly) as an undocumented ' |
- | - pidfile: / | + | # |
- | - | + | ### BEGIN INIT INFO |
- | - | + | # Provides: popfile |
+ | # Required-Start: | ||
+ | # Required-Stop: | ||
+ | # Default-Start: 345 3 4 5 | ||
+ | # Default-Stop: 345 3 4 5 | ||
+ | # Description: popfile is a POP3 proxy and mail filter | ||
+ | ### END INIT INFO ## | ||
- | - | + | # Source function library. |
- | - LSB comment block... | + | |
- | - | + | |
- | - The bogus 345 run-levels are a workround for a buggy RedHat chkconfig which | + | |
- | - reads the LSB comment block (incorrectly) as an undocumented ' | + | |
- | - | + | |
- | - BEGIN INIT INFO | + | |
- | - Provides: popfile | + | |
- | - Required-Start: | + | |
- | - Required-Stop: | + | |
- | - Default-Start: | + | |
- | - Default-Stop: | + | |
- | - Description: | + | |
- | - END INIT INFO ## | + | |
- | + | ||
- | - Source function library. | + | |
if [ -f / | if [ -f / | ||
- | < | + | |
elif [ -f / | elif [ -f / | ||
- | < | + | |
else | else | ||
- | < | + | |
fi | fi | ||
Line 111: | Line 110: | ||
popfile=" | popfile=" | ||
- | - Setup variables | + | # Setup variables |
folder_saved=`pwd` | folder_saved=`pwd` | ||
start() { | start() { | ||
- | < | + | |
- | echo -n " | + | echo -n " |
- | | + | ${popfile} >> /dev/null 2>&1 & |
- | echo -n " | + | echo -n " |
- | # echo -en " | + | # echo -en " |
} | } | ||
stop() { | stop() { | ||
- | < | + | |
- | | + | pid=`ps -ef | grep perl | grep popfile.pl | gawk ' |
- | if [ " | + | |
- | | + | echo " |
- | | + | else |
- | | + | kill $pid |
- | fi | + | fi |
- | #echo -en " | + | #echo -en " |
- | echo success && echo</ | + | echo success && echo |
} | } | ||
status() { | status() { | ||
- | < | + | |
- | if [ " | + | |
- | | + | echo " |
- | | + | else |
- | | + | echo " |
- | fi</ | + | fi |
} | } | ||
case " | case " | ||
start) | start) | ||
- | < | + | |
- | ;;</ | + | ;; |
stop) | stop) | ||
- | < | + | |
- | ;;</ | + | ;; |
restart) | restart) | ||
- | < | + | |
- | | + | start |
- | ;;</ | + | ;; |
status) | status) | ||
- | < | + | |
- | ;;</ | + | ;; |
- | *) | + | *) |
- | < | + | echo $" |
- | exit 1 | + | exit 1 |
- | ;;</ | + | ;; |
esac | esac | ||
- | - Back to original folder | + | # Back to original folder |
cd $folder_saved | cd $folder_saved | ||
exit 0 | exit 0 | ||
- | ---- SCRIPT END</ | + | #--- SCRIPT END |
+ | </ | ||
Should you find anything in the documentation that is incomplete, unclear, outdated or just plain wrong, please let us know and leave a note in the Documentation Forum.