Fedora Linux Support Community & Resources Center
  #1  
Old 18th September 2011, 02:15 PM
seabird Offline
Registered User
 
Join Date: Jan 2009
Location: Den Bosch, Netherlands
Posts: 260
windows_7ie
Auto start

Hello everyone,

I have a server where I know I want to start some programs at boot in a screen. I know exaclty what I want them to do.
Code:
at start issue:
su USER -c 'screen -dmS irssi irssi'
at shutdown (or reboot):
su USER -c 'screen -S irssi -X stuff "/quit $(echo -ne "\r")"'
Now I would like to have this run in the "service list and be able to select it using chkconfig.

So I am guessing it will look something like this: (not sure how to write the bold part)
Code:
#!/bin/sh
#
# chkconfig: - 92 35
# description: Starts and stops the IRSSI in \
#              detached screen for jacco.


# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 1
fi

# Avoid using root's TMPDIR
unset TMPDIR

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1

RETVAL=0

start() {
        KIND="IRSSI"
        echo -n $"Starting $KIND services: "
        su USER -c 'screen -dmS irssi irssi'
         RETVAL=$?
        echo
         [ $RETVAL -eq 0 ] && succes || failure
       RETVAL=1
        return $RETVAL
}

stop() {
        KIND="IRSSI"
        echo -n $"Shutting down $KIND services: "
        su USER -c 'screen -S irssi -X stuff "/quit $(echo -ne "\r")"'
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && succes || failure
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  *)
        echo $"Usage: $0 {start|stop}"
        exit 2
esac

exit $?
Starting does work in this script but it is reported back as failed ..... stopping does not work (but reports it does)
__________________
OS: Fedora 16
Casing: Chenbro RM21508B
Mainboard: ATX D2778
Processor: Intel Xeon W3550 (8 core)
Memory: 6Gb DDR3, ECC, 1333 MHz, PC3-10600
HD #1: OCZ Vertex 3 60Gb
Storage Drives: 4x 2Tb WD20EARS + 2x 2Tb WD20EARX
Graphics: Nvidia GeForce 210 Silent
PCI Card: Promise FastTrak TX4

Last edited by seabird; 18th September 2011 at 03:02 PM.
Reply With Quote
  #2  
Old 18th September 2011, 03:24 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,105
linuxfedorafirefox
Re: Auto start

Since you are using fedora 15, the stopping will not work because the task is marked failed.

On the start, try "exit 0" instead of "exit $?". You are not returning the success exit status (0), but something else.
Reply With Quote
  #3  
Old 18th September 2011, 07:28 PM
seabird Offline
Registered User
 
Join Date: Jan 2009
Location: Den Bosch, Netherlands
Posts: 260
windows_7ie
Re: Auto start

Quote:
Originally Posted by jpollard View Post
On the start, try "exit 0" instead of "exit $?".
That did the trick, thnx
__________________
OS: Fedora 16
Casing: Chenbro RM21508B
Mainboard: ATX D2778
Processor: Intel Xeon W3550 (8 core)
Memory: 6Gb DDR3, ECC, 1333 MHz, PC3-10600
HD #1: OCZ Vertex 3 60Gb
Storage Drives: 4x 2Tb WD20EARS + 2x 2Tb WD20EARX
Graphics: Nvidia GeForce 210 Silent
PCI Card: Promise FastTrak TX4
Reply With Quote
Reply

Tags
auto, start

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to auto start B43 toddhump Servers & Networking 5 11th February 2013 07:51 AM
Auto start a program on start up? KirkD Using Fedora 13 12th October 2009 05:29 AM
i want AWN to start up auto? $Linux Using Fedora 2 10th February 2008 12:04 AM
Auto-Reboot + Auto-Start Certain Apps P4rD0nM3 Using Fedora 1 25th January 2008 06:03 PM


Current GMT-time: 02:26 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat