Ask Your Question
1

start script on boot fedora 16

asked 2012-01-18 18:31:51 -0600

samuaz gravatar image

updated 2012-02-02 03:50:45 -0600

FranciscoD_ gravatar image

hi people,

i have a problem i need start a script for my fan on boot, like a new service, but im try the add the next lines on my script:

#!/bin/bash
#chkconfig: 345 85 15
#description: smcfancontrol

save it in /etc/init.d/

and in terminal:

chkconfig --add smcfancontrol

but if I do this, and reboot my system does not start again, I have to start with the live cd and delete my script smcFanControl to make the system start again.

I am doing wrong?.

also try to create a script that contains my root password and followed the command to start the script of the fan, and then add it to gnome-session-properties.

but does not work does not start with the login, the script is good because I can start it manually without problems

any idea

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-01-18 21:42:57 -0600

sagarun gravatar image

I think you are trying to create a init script, Have a look at this https://fedoraproject.org/wiki/Packaging:SysVInitScript#Initscript_template

Does your init script has options to start/stop/restart a service?

Fedora has moved from SysVInit scripts to systemd. You might want to create a systemd service file instead of a sysVinit script. see http://0pointer.de/blog/projects/systemd-for-admins-3.html

edit flag offensive delete link more
0

answered 2012-01-21 12:01:08 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi samuaz,

You 're in the good way but your shell script isn't right. Firstable read man chkconfig For example:

#! /bin/bash
#
# smcfancontrol fan control     
#
# chkconfig: 345 85 15
# description: Activates/Deactivates fan
#
### BEGIN INIT INFO
# Provides: <your info>
# Should-Start: <your info>
# Short-Description: <your info>
# Description: <your info>
### END INIT INFO

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

# local
. /$HOME

# See how we were called.
case "$1" in
  start)
    echo "the script UP "
    <your fan service>
    ;;
  stop)
    echo "the script DOWN"
    # this is an exmaple
    pkill <your fan service>
    ;;
  *)
    echo "Usage: /etc/init.d/smcfancontrol {start|stop}"
    exit 1
    ;;
esac
exit 0

Then:

$ sudo chkconfig --level  345 85 15 smcfancontrol
$ sudo chkconfig --add smcfancontrol

And the last step, to check:

$ sudo chkconfig --list
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-01-18 18:31:51 -0600

Seen: 16,940 times

Last updated: Feb 02 '12