Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> File Formats
MaverickApollo
post Oct 20 2003, 12:21 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 10
Joined: 10-October 03
Member No.: 1,599



I have a rc script that wont run, and I think (I know) it is in the wrong format, PC formatted not unix formatted, so it is'nt working. Can any one tell me how I can check the formatting and change it?

Many Thnaks

Michael.
Go to the top of the page
 
+Quote Post
MaverickApollo
post Oct 20 2003, 04:02 PM
Post #2


Whats this Lie-nix Thing?
*

Group: Members
Posts: 10
Joined: 10-October 03
Member No.: 1,599



Also, I have another script that runs fine when I have typed its' name on the command line such as

/etc/rc.d/init.d/scriptname start

This starts it fine without problems. Doing tail /var/log/messages does not show any errors.
I have set it to start at boot up, but it dosnt run. I need to enter the script name manually before it runs.

If I do a chkconfig --list it shows it is registered in run levels 2345, which is where it should be. It is scheduled to start on system boot by doing

/usr/sbin/setup and going to system setup, and setting it there. I have also checked in the RH9 GUI version of the system startup util.

Anyone got any ideas?
Go to the top of the page
 
+Quote Post
hughesjr
post Oct 20 2003, 04:38 PM
Post #3


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



As to the scripts that run when typed from the command line and not on startup, the most common cause is that you need to either set the PATH in the script or include the full pathname to all executables ..(ie /bin/grep instead of just grep) ... when you type something from the command line, the environment for root is setup, but when running at startup that is not necessarily the case.

The easy thing to do is to include the following statement in all startup scripts:

PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin
----------------------------------
As to the formating ... I think you mean that there are dos CRLF's at the end of the lines in the file...how you can see if this is the case is to open the file with gedit ... it will show a ^M or ^P at the end of the lines if they are wrong.

I use notetab light to save text files in UNIX format if I am going to move them from a dos machine to a Unix machine ... in notetab go to the menu selection Document then select Properties then choose UNIX in the Format dropdown box.

You can use notetab light to same your current dos text file in UNIX text mode...


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
MaverickApollo
post Oct 20 2003, 05:28 PM
Post #4


Whats this Lie-nix Thing?
*

Group: Members
Posts: 10
Joined: 10-October 03
Member No.: 1,599



The full path is specified in the script.

I'll try adding the path variables

Heres a copy of the script:

#!/bin/bash
#
# Script to run Fetchmail software at boot time.
#
# Last Updated: 31st August 2003
#
# This script is based upon the init scripts
# as used on Red Hat Linux.
#
# The script has been tested on RH 7.x, 8.0, and 9.0
#
# Author: Gary Myers AMBCS
# mailto: gary@gaztronics.co.uk
#
# This script is realeased under the terms of the GPL.
# You can source a copy at:
# http://www.fsf.org/copyleft/copyleft.html

#====================================================================
# Run level information
#
# chkconfig: 2345 99 90
# description: Fetchmail
#
# Run "/sbin/chkconfig --add seti" to add the Run levels;
# this *should* setup the symlinks!
#====================================================================

PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin
#====================================================================
# Set the path to the executable.
#
FETCHMAIL=/usr/bin/fetchmail

# Set the path to the runtime control file.
#
FRC=/root/.fetchmailrc

# Path to the lock file.
#
LOCK_FILE=/var/lock/subsys/fetchmail

# Set this time for daemon operations.
# Default for this config is 1 hour.
#
TIME=200

#====================================================================

#====================================================================

# System checks:

# Source function library
. /etc/rc.d/init.d/functions

# Check that networking is up.
# No point in trying to send or recieve otherwise!!
[ ${NETWORKING} ="yes" ] || exit 0

# Check we have the fetchmail program installed.
if [ ! -x $FETCHMAIL ] ; then
echo "Cannot find Fetchmail executable!"
exit 0
fi

# Check the .fetchmailrc file exists - fetchmail doesn't run
# in daemon mode without it.

if [ ! -f $FRC ] ; then
echo "Cannot find the runtime control file!"
exit 0
fi

#====================================================================

prog=$"Fetchmail"

RETVAL=0

start() {
if [ -f $LOCK_FILE ]; then
echo "Fetchmail is already running!"
exit 0

else

echo -n $"Starting $prog: "
$FETCHMAIL --daemon $TIME >/dev/null 2>&1
fi

RETVAL=$?
[ $RETVAL -eq 0 ] && success
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
return $RETVAL
}

stop() {
echo -n $"Shutting down $prog: "
killproc fetchmail
RETVAL=$?
[ $RETVAL -eq 0 ]
rm -f $LOCK_FILE
echo
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCK_FILE ]; then
stop
start
RETVAL=$?
fi
;;
status)
status fetchmail
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac

exit $RETVAL
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th October 2017 - 09:51 AM