LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-23-2011, 12:16 AM   #1
daletroN3030
LQ Newbie
 
Registered: Dec 2011
Posts: 9

Rep: Reputation: Disabled
How can I make Mint load a terminal command at startup?


Hi everyone, I'm new to Linux and installed Mint version 9 Gnome on my Asus EEE netbook.

I'm trying to load a terminal command "syndaemon -d -i 1" everytime my netbook boots up.. but am having problems accomplishing it.

so that i don't have to type everything up again.. and so you guys can see the attempted solutions i've tried, i hope it's okay that I link my post to another forum.

http://forums.linuxmint.com/viewtopic.php?f=90&t=89221

i'm hoping this forum can help me! thanks everyone

Last edited by daletroN3030; 12-23-2011 at 01:15 AM.
 
Old 12-23-2011, 01:02 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello and welcome to LinuxQuestions,

Why don't you write an init script for it and activate it in the desired runlevel? If I'm not mistaking in your /etc/init.d directory there should be a file named skeleton. That's an 'empty' example for an init script. Adapt it to your needs and activate it with:
Code:
sudo insserv -d <yourscriptname>
Then next time you boot your computer boots up, the command indicated in the script will launch if you've put it in the correct runlevel.

Another option, if you just want that one command executed, is to add is to /etc/rc.local, which gets executed at the end of each multi-user runlevel.

Looking forward to your participation in the forums. Have fun with Linux.

Kind regards,

Eric
 
Old 12-23-2011, 01:27 AM   #3
daletroN3030
LQ Newbie
 
Registered: Dec 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
Hello and welcome to LinuxQuestions,

Why don't you write an init script for it and activate it in the desired runlevel? If I'm not mistaking in your /etc/init.d directory there should be a file named skeleton. That's an 'empty' example for an init script. Adapt it to your needs and activate it with:
Code:
sudo insserv -d <yourscriptname>
Then next time you boot your computer boots up, the command indicated in the script will launch if you've put it in the correct runlevel.

Another option, if you just want that one command executed, is to add is to /etc/rc.local, which gets executed at the end of each multi-user runlevel.

Looking forward to your participation in the forums. Have fun with Linux.

Kind regards,

Eric
=[

ok all that was really wayy over my head...lol. i took a look at the skeleton file and there's a bunch of stuff in there that im scared to touch.. i have no idea where i would even put my "syndaemon -d -i 1" in that file.. there's so much stuff. even then... do i copy and paste all that stuff in there, insert my line of code somewhere in there, then save it to my own script file? i'm really really new to linux, laymen's terms would be appreciated >.<

as for the second option.. as for the thread i linked, i did try adding it to the rc.local file, but it doesn't seem to be activating for some reason....
 
Old 12-23-2011, 01:52 AM   #4
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 201

Rep: Reputation: 36
Since Mint is based on debian I guess you will be able to solve your problem following this guide.
 
1 members found this post helpful.
Old 12-23-2011, 01:57 AM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Quote:
Originally Posted by daletroN3030 View Post
=[

ok all that was really wayy over my head...lol. i took a look at the skeleton file and there's a bunch of stuff in there that im scared to touch.. i have no idea where i would even put my "syndaemon -d -i 1" in that file.. there's so much stuff. even then... do i copy and paste all that stuff in there, insert my line of code somewhere in there, then save it to my own script file? i'm really really new to linux, laymen's terms would be appreciated >.<

as for the second option.. as for the thread i linked, i did try adding it to the rc.local file, but it doesn't seem to be activating for some reason....
Hi,

Don't be scared! Linux is all about learning the hard way It's not that hard if you have a good look at the skeleton. Basically your command(s) + parameters to start your process goes in the 'do_start' part and the ones to stop in the do_stop part. Change the values in the LSB header (the first part) to indicate your run level(s) you want to start/stop in, any dependencies your command might have and a description.

If you have any questions when trying, don't hesitate to ask.

Kind regards,

Eric
 
Old 12-23-2011, 03:13 AM   #6
daletroN3030
LQ Newbie
 
Registered: Dec 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rodrifra View Post
Since Mint is based on debian I guess you will be able to solve your problem following this guide.
so i did everything except for where it says under "An Example" and it says I can add the following line to /etc/init.d/rc.local.. then gives an example of mounting a drive. so what line would i put to execute that script i just made? and where would i put it exactly:

GNU nano 2.2.2 File: /etc/init.d/rc.local


PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions

do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scrip$
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}

case "$1" in
start)
do_start

^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell
 
Old 12-23-2011, 03:22 AM   #7
daletroN3030
LQ Newbie
 
Registered: Dec 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
Hi,

Don't be scared! Linux is all about learning the hard way It's not that hard if you have a good look at the skeleton. Basically your command(s) + parameters to start your process goes in the 'do_start' part and the ones to stop in the do_stop part. Change the values in the LSB header (the first part) to indicate your run level(s) you want to start/stop in, any dependencies your command might have and a description.

If you have any questions when trying, don't hesitate to ask.

Kind regards,

Eric
sigh it's just REALLY REALLY frustrating... im about to go back to friggin windows... i've tried so much crap already and can't get this to work.. and there's way too many terms that i just don't know wth people are talking about. LSB header?

so i opened my skeleton folder and put this:

GNU nano 2.2.2 File: skeleton


#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
syndaemon -d -i 1
}


^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell



and of course that doesn't work. so i guess i'm supposed to make a script that has the syndaemon -d -i 1 in it? and then do the sudo insserv -d <mynamescript>? and i dont think i put anything under stop? because it's just a one time thing? of course im just assuming..

can you please show me how to do all this in very baby steps? im seriously bout to throw this netbook across the room or something... i really wanted to like linux but this is just crazy

Last edited by daletroN3030; 12-23-2011 at 03:28 AM.
 
Old 12-23-2011, 03:36 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

Don't get your nerves up that high, take it one step at the time. The syndaemon, is that a command you want to execute that's in your path or is it a script? Don't forget to put in the LSB block at the beginning of the file, including the shebang (#!/bin/bash) on the very first line! That first line indicates to Linux that the following in your file needs to be interpreted by bash. Without it you'll not get it to work. Start with that and post what you got then. Please post it between CODE tags for visibility.

Kind regards,

Eric
 
Old 12-23-2011, 03:41 AM   #9
daletroN3030
LQ Newbie
 
Registered: Dec 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
Hi,

Don't get your nerves up that high, take it one step at the time. The syndaemon, is that a command you want to execute that's in your path or is it a script? Don't forget to put in the LSB block at the beginning of the file, including the shebang (#!/bin/bash) on the very first line! That first line indicates to Linux that the following in your file needs to be interpreted by bash. Without it you'll not get it to work. Start with that and post what you got then. Please post it between CODE tags for visibility.

Kind regards,

Eric
trying =[

i dont think it's neither a path nor script? pretty much when i open the terminal.. i have to type "syndaemon -d -i 1" (to make my touchpad nonresponsive when typing, drives me nuts if i dont have this). so it's just a command i guess?

i have no idea what a LSB block is =[

so are you saying to make a file that contains:

Code:
#!/bin/bash
syndaemon -d -i 1
or since it's just a command i dont have to do that? if so, or if not, where do i go from here

thank you for your patience.

edit: oh and if i do have to make a file that contains that.. where do i put it?

Last edited by daletroN3030; 12-23-2011 at 03:42 AM.
 
Old 12-23-2011, 03:47 AM   #10
thorkelljarl
Senior Member
 
Registered: Jun 2008
Posts: 1,796

Rep: Reputation: 213Reputation: 213Reputation: 213
linux...

Linux is frustrating, different, and sometimes funny.

http://www.outpost9.com/reference/ja...argon_toc.html
 
Old 12-27-2011, 08:28 AM   #11
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 201

Rep: Reputation: 36
Quote:
Originally Posted by daletroN3030 View Post
so i did everything except for where it says under "An Example" and it says I can add the following line to /etc/init.d/rc.local.. then gives an example of mounting a drive. so what line would i put to execute that script i just made? and where would i put it exactly:

GNU nano 2.2.2 File: /etc/init.d/rc.local


PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions

do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scrip$
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}

case "$1" in
start)
do_start

^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell
Sorry for the late answer, hope you haven't switched back to windows yet

It should be as simple as creating a file with the line you want to execute /usr/bin/syndaemon -d -i 1, give that file execute permissions and run the sudo update-rc.d local defaults 80 and you should be ready.

You don't need to make your script LSB compliant, if you only want to do what you told you want to do, either you follow the steps of the guide or you can do it manually. To do it manually follow the next steps (that work on my ubuntu box, I guess mint will be the same):

sudo bash
cd /etc/init.d
echo /usr/bin/syndaemon -d -i 1 > mylocal
chmod 755 mylocal
cd /etc/rcS.d
ln -s /etc/init.d/mylocal S99mylocal

Restart your computer and your file should've been executed.
 
  


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
terminal command on startup mike4586 Debian 2 11-06-2011 04:54 PM
[SOLVED] Make linux terminal transparent with terminal command? yooy Linux - Newbie 1 05-11-2010 03:24 AM
can only load terminal up from startup intheshadows Linux - Newbie 6 10-24-2007 03:41 PM
Make CUPS load at startup PeteWieland Linux - Newbie 7 04-01-2005 12:54 PM
Load command at KDE startup, possible? thcmwz Linux - Software 1 09-19-2003 10:59 PM


All times are GMT -5. The time now is 10:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration