LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-22-2011, 06:54 PM   #1
digilink
LQ Newbie
 
Registered: Jun 2008
Posts: 5

Rep: Reputation: 0
Executing a script at boot time


All right... I give up. I've been trying to make this happen for the course of an hour now and it's just not cooperating with me, so I'm obviously doing something wrong

Here's what I'm trying to accomplish:
Execute a script as a non-root user at boot time. The script lives in /home/sbrown/scripts and has the executable bits set. If I run the script locally in the shell it behaves as normal, but will not at boot time It's a very simple 2 line script:
#!/bin/bash
# Starts IRSSI in a screen session
sudo -u sbrown screen -S irssi irssi

Here's WHAT DOESN'T work:
I put this in /etc/rc.local: sudo -u sbrown /home/sbrown/scripts/irssi_exec
I also tried just copying the script to /etc/init.d/ and chowning it to root then ran update-rc.d irssi_exec defaults and rebooted. Still not working.

This is on a Debian Squeeze box... what am I missing? Surely it should be simpler than this
 
Old 04-22-2011, 06:58 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Assuming that you use Gnome, you should have something like "Session and Startup" in your preferences menu. There you can add autostart-applications. Remember, if you use screen, you have to start the applications in a terminal.
 
Old 04-22-2011, 07:04 PM   #3
digilink
LQ Newbie
 
Registered: Jun 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TobiSGD View Post
Assuming that you use Gnome, you should have something like "Session and Startup" in your preferences menu. There you can add autostart-applications. Remember, if you use screen, you have to start the applications in a terminal.
Nope, no X on this server, purely CLI. Is screen the potential hangup here?
 
Old 04-22-2011, 07:21 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If you don't use X it should be even simpler. Just add your command to your ~./bashrc.
Or you change your /etc/inittab (be careful with that, make a backup copy first and have a live-medium at hand to fix it if something goes wrong) to start it on a virtual console.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
running script at boot time bigtl Fedora 3 12-19-2005 11:30 AM
Auto-Executing Shell Script on boot benrose111488 Linux - Software 5 12-18-2004 12:52 AM
starting the script at boot time hudy_rob Mandriva 4 12-09-2004 10:29 AM
executing a time-triggered script leosuth Programming 7 06-02-2004 08:15 AM
Stop boot script at boot time!! kmiles2 Linux - Newbie 1 02-23-2004 10:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:51 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