LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-20-2010, 05:57 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
start an user script at boot: Shall we prefer the INITTAB or /etc/init.d method ?


Hello,

In order to start some scripts from an user, it is better to favour INITTAB or /etc/init.d method?
Quote:
#include <unistd.h>
int main() {
execlp( "login", "login", "-f", "fred", 0);
}

then
gcc -o autologinfred autologinfred.c

then modify:
1:2345:respawn:/sbin/getty -n -l /usr/local/sbin/autologinfred 38400 tty1
then
change the .bashrc


or


/etc/init.d/S98startuserscripts
Code:
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
if [ `id -u` = 0 ] ; then
  #echo switching to freevo user
  #exec su --shell /bin/sh fred -c "$0 $@"
  su --shell /bin/bash fred -c "sh $HOME/mysupermegascript"
fi
exit 0
What is more secured, what is more standard, what is better, what is more debian i.e. stable?

Last edited by frenchn00b; 01-20-2010 at 06:00 AM.
 
Old 01-21-2010, 06:01 AM   #2
jens
Senior Member
 
Registered: May 2004
Location: Belgium
Distribution: Debian, Slackware, Fedora
Posts: 1,465

Rep: Reputation: 299Reputation: 299Reputation: 299
inittab is used for all needed stuff (defaults) to boot your system (init reads this when booting).

/etc/init.d is the normal place for customizing the above and supports more user interaction

Last edited by jens; 01-21-2010 at 06:05 AM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Init script in /etc/init.d does not start at boot tdnnash25 Linux - Server 4 12-18-2009 04:40 PM
start init.d scripts before a chroot script using schroot? arobinson74 Linux - Software 1 10-11-2009 04:05 PM
[SOLVED] how to start an application using the rc.local init script? sl33p Linux - Newbie 4 07-07-2009 04:06 PM
custom init.d script will start but won't stop Qwerty9119 Red Hat 2 05-03-2007 12:51 PM
custom init.d script will start but won't stop Qwerty9119 Linux - General 2 05-03-2007 12:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 11:56 PM.

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
Open Source Consulting | Domain Registration