LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 10-30-2006, 04:13 AM   #1
muleypr
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Rep: Reputation: 0
auto run script


Hi,

I have one problem interms of auto run script.

I had one application that sets the mixer settings (incase of oss driver).

I want to run this application executable whenever i switch ON my machine.

So can u tell me what should i do??
where should i kept this exe and what is procedure ??

-Prashant
 
Old 10-30-2006, 04:41 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
add it to /etc/rc.local if you're on a system like redhat or fedora.
 
Old 10-30-2006, 04:45 AM   #3
muslim
LQ Newbie
 
Registered: Oct 2006
Distribution: arabian
Posts: 11

Rep: Reputation: 0
It can be different from a distro to an other, but in mine (Debian based) I just put the application shortcut in /home/...(username)/.kde/Autostart and it will be runed every time I log in.
 
Old 10-30-2006, 05:16 AM   #4
muleypr
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
Hi,

Thankx for ur reply....

I am using Montavista Linux pro 4.0. It dosen't have /etc/rc.local file.
It has, dir structure .....
/etc
|
/rc.d
|
/init.d /rc0.d /rc1.d /rc2.d /rc3.d /rc4.d /rc5.d /rc6.d /rcS.d
| | | | | | | | | |


I am not able to understand where should i put exe?
and one IMP point is that ...only putting exe in specific dir is ok ? or need to make any entry in somewhere in file/table/script ..otherwise how did os recognize that there is new exe that should be run by itself?

-Prashant
 
Old 10-30-2006, 05:16 AM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
You should include more details in your post. For example: putting your distro in your profie; and in the post indicating the name of the application if it isn't one you wrote yourself; the type of application, gui or cli based; if it is a gui program, which window manager you are using, such as KDE or Gnome.
 
Old 10-30-2006, 05:28 AM   #6
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
please post the content of this file: /etc/inittab

Yves.
 
Old 10-30-2006, 05:33 AM   #7
muleypr
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
content of file: /etc/inittab


# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

# The default runlevel.
id:3:initdefault:

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS

# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin

# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."

# What to do when the power fails/returns.
pf:owerwait:/etc/init.d/powerfail start
pn:owerfailnow:/etc/init.d/powerfail now
po:owerokwait:/etc/init.d/powerfail stop

# This line provides a nice out-of-box experience. For regular use, you
# should replace it with the proper getty lines below.
con:2345:respawn:/sbin/getty console

# /sbin/getty invocations for the runlevels.
#
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Uncomment these for a devfs system
#
#1:2345:respawn:/sbin/getty 38400 vc/1
#2:23:respawn:/sbin/getty 38400 vc/2
#3:23:respawn:/sbin/getty 38400 vc/3
#4:23:respawn:/sbin/getty 38400 vc/4
#5:23:respawn:/sbin/getty 38400 vc/5
#6:23:respawn:/sbin/getty 38400 vc/6
#
# Uncomment these only for non-devfs systems
#
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
# Uncomment these for a devfs system
#
#T0:23:respawn:/sbin/getty -L tts/0 9600 vt100
#T1:23:respawn:/sbin/getty -L tts/1 9600 vt100
#
# Uncomment these only for non-devfs systems
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

# Example how to put a getty on a modem line.
#
# Uncomment this for a devfs system
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 tts/3
#
# Uncomment these only for non-devfs systems
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3
 
Old 10-30-2006, 05:50 AM   #8
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
OK so the interesting script here is /etc/init.d/rc
Could you post the content of this one?

Yves.
 
Old 10-30-2006, 05:55 AM   #9
muleypr
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
/etc/init.d/rc file
-----------------------

#! /bin/sh
#
# rc This file is responsible for starting/stopping
# services when the runlevel changes.
#
# Optimization feature:
# A startup script is _not_ run when the service was
# running in the previous runlevel and it wasn't stopped
# in the runlevel transition (most Debian services don't
# have K?? links in rc{1,2,3,4,5} )
#
# Author: Miquel van Smoorenburg <miquels@cistron.nl>
# Bruce Perens <Bruce@Pixar.com>
#
# Version: @(#)rc 2.78 07-Nov-1999 miquels@cistron.nl
#

# Un-comment the following for debugging.
# debug=echo

#
# Start script or program.
#
startup() {
case "$1" in
*.sh)
$debug sh "$@"
;;
*)
$debug "$@"
;;
esac
}

# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
trap ":" INT QUIT TSTP

# Set onlcr to avoid staircase effect.
stty onlcr 0>&1

# Now find out what the current and what the previous runlevel are.

runlevel=$RUNLEVEL
# Get first argument. Set new runlevel to this argument.
[ "$1" != "" ] && runlevel=$1
if [ "$runlevel" = "" ]
then
echo "Usage: $0 <runlevel>" >&2
exit 1
fi
previous=$PREVLEVEL
[ "$previous" = "" ] && previous=N

export runlevel previous

# Is there an rc directory for this new runlevel?
if [ -d /etc/rc.d/rc$runlevel.d ]
then
# First, run the KILL scripts.
if [ $previous != N ]
then
for i in /etc/rc.d/rc$runlevel.d/K[0-9][0-9]*
do
# Check if the script is there.
[ ! -f $i ] && continue

# Stop the service.
startup $i stop
done
fi
# Now run the START scripts for this runlevel.
for i in /etc/rc.d/rc$runlevel.d/S*
do
[ ! -f $i ] && continue

if [ $previous != N ] && [ $previous != S ]
then
#
# Find start script in previous runlevel and
# stop script in this runlevel.
#
suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]}
stop=/etc/rc.d/rc$runlevel.d/K[0-9][0-9]$suffix
previous_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix
#
# If there is a start script in the previous level
# and _no_ stop script in this level, we don't
# have to re-start the service.
#
[ -f $previous_start ] && [ ! -f $stop ] && continue
fi
case "$runlevel" in
0|6)
startup $i stop
;;
*)
startup $i start
;;
esac
done
fi
# eof /etc/init.d/rc
 
Old 10-30-2006, 06:30 AM   #10
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
OK. As you see from the first file, you're in runlevel 3. As you see from this second file, you will thus more or less execute all /etc/rc.d/rc3.d/K* then S* scripts.
Could you run (as root): ls -l /etc/rc.d/rc3.d/
You'll probably find that one service there is named S##*local* (a S* link with "local" in the name), if that is so, post the content of this file (the link probably points to a file in /etc/rc.d/init.d).

Yves.
 
Old 10-30-2006, 06:39 AM   #11
muleypr
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
ls -l /etc/rc.d/rc3.d/

lrwxrwxrwx 1 root root 16 Mar 30 2006 S10syslog -> ../init.d/syslog
lrwxrwxrwx 1 root root 20 Mar 30 2006 S19nfs-common -> ../init.d/nfs-common
lrwxrwxrwx 1 root root 15 Mar 30 2006 S20inetd -> ../init.d/inetd
lrwxrwxrwx 1 root root 19 Mar 30 2006 S88demo -> ../init.d/dvevmdemo
lrwxrwxrwx 1 root root 15 Mar 30 2006 S90mvltd -> ../init.d/mvltd
lrwxrwxrwx 1 root root 19 Mar 30 2006 S99rmnologin -> ../init.d/rmnologin


so here, no any service named S##*local*. ??
 
Old 10-30-2006, 06:42 AM   #12
muleypr
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
Suppose i put my exe in "/etc/init.d/". will it work??
 
Old 10-30-2006, 06:46 AM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
nope, won't do a thing. what distro are you using? if you want to add a local service you'd just create a link from S99local in your chosen runlevel directory as above, to /etc/rc.local and then ad whatever command to that script, after setting /etc/rc.local as an exectuable script.
 
Old 10-30-2006, 06:51 AM   #14
muleypr
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
I am using Montavista Linux Pro 4.0
There is no any /etc/rc.local file .
I have mentioned already distro and the dir structure under /etc
 
Old 10-30-2006, 06:54 AM   #15
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
oh yeah, fair enough... so as above then... does that make sense?
 
  


Reply

Tags
general, linux


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
auto run bash script when logged in linuxmandrake Fedora 1 06-11-2005 09:22 PM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 05:51 PM
shell script fo run auto job in cron JolynnMarie LinuxQuestions.org Member Intro 0 04-28-2004 12:21 PM
Getting firewall script to auto-run at startup lrt2003 Linux - Newbie 2 04-25-2004 03:28 AM
Auto Run A Cgi Script f117bomb Linux - General 1 11-25-2001 02:18 AM


All times are GMT -5. The time now is 11:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration