How to run commands on startup

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

How to run commands on startup

Postby Taffman on Wed Jan 16, 2013 11:10 am

I need to run the following commands each time I boot up:

sudo setserial /dev/ttyS4 uart 16550A
sudo setserial /dev/ttyS5 uart 16550A
sudo setserial /dev/ttyS6 uart 16550A
sudo setserial /dev/ttyS7 uart 16550A

I have tried adding them to /etc/rc.local but i don't think Mint reads this file on startup.

an anyone tell me where I can store the above commands so that they are executed on startup please?
Linux Mint 17 Cinnamon 32-bit, Dell Dimension 9200, 4GB, 2.4GHz Core2, Radeon X1300
User avatar
Taffman
Level 3
Level 3
 
Posts: 106
Joined: Fri May 06, 2011 10:51 am
Location: United Kingdom

Linux Mint is funded by ads and donations.
 

Re: How to run commands on startup

Postby russellz on Wed Jan 16, 2013 11:33 am

Try /etc/init.d/rc.local ?

Russell.
Toshiba Satellite C870 13V laptop. Mint Mate 17
User avatar
russellz
Level 2
Level 2
 
Posts: 68
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

Re: How to run commands on startup

Postby viking777 on Wed Jan 16, 2013 12:15 pm

Commands executed from /etc/rc.local (or /etc/init.d/rc.local if you decide to try that) are run as root so they do not require sudo. Remove sudo from the commands and see if it makes any difference - I don't know if it will, but it is worth a try.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: How to run commands on startup

Postby Taffman on Wed Jan 16, 2013 1:08 pm

Nope, that didn't work either.
Linux Mint 17 Cinnamon 32-bit, Dell Dimension 9200, 4GB, 2.4GHz Core2, Radeon X1300
User avatar
Taffman
Level 3
Level 3
 
Posts: 106
Joined: Fri May 06, 2011 10:51 am
Location: United Kingdom

Re: How to run commands on startup

Postby viking777 on Wed Jan 16, 2013 1:26 pm

OK lets start with the simple questions - have you tried running these commands after startup from a terminal and if so do they work - you haven't said. Without an answer to that question everything else is irrelevant.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: How to run commands on startup

Postby Taffman on Wed Jan 16, 2013 1:27 pm

These commands work when manually entered in Terminal.
but these settings do not persist after a reboot.


not sure if I need "sudo" here though, i do in Terminal from my user account.
Linux Mint 17 Cinnamon 32-bit, Dell Dimension 9200, 4GB, 2.4GHz Core2, Radeon X1300
User avatar
Taffman
Level 3
Level 3
 
Posts: 106
Joined: Fri May 06, 2011 10:51 am
Location: United Kingdom

Re: How to run commands on startup

Postby viking777 on Wed Jan 16, 2013 1:47 pm

OK this is what I would try:

Make a shell script from the commands you want to run:

Code: Select all
#!/bin/bash

setserial /dev/ttyS4 uart 16550A
setserial /dev/ttyS5 uart 16550A
setserial /dev/ttyS6 uart 16550A
setserial /dev/ttyS7 uart 16550A


Save it as setserial.sh and make it executable. If, as you say above you don't need sudo to run these commands you can save it to your home folder.

Now go to the program 'Startup Application' and add a new entry. Call it Setserial (or anything you like it doesn't matter) make the command to run

Code: Select all
/home/yourusername/setserial.sh


I hope you appreaciate that it has to be your real username, not what I have just typed.

I start several programs this way and it always works for me, if it doesn't then it may be a permissions issue in which case my instinct would be to move setserial.sh to /usr/bin and change the ownership to root. I don't know if this works - I have never tried it.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: How to run commands on startup

Postby Taffman on Wed Jan 16, 2013 1:52 pm

Ok I'll try that. thanks for your help.
Linux Mint 17 Cinnamon 32-bit, Dell Dimension 9200, 4GB, 2.4GHz Core2, Radeon X1300
User avatar
Taffman
Level 3
Level 3
 
Posts: 106
Joined: Fri May 06, 2011 10:51 am
Location: United Kingdom

Re: How to run commands on startup

Postby Taffman on Wed Feb 20, 2013 1:32 pm

I cant seem to get any scripts to run on startup using the Startup Applications menu option or by adding commands to /etc/rc.local
Anyone know the trick to this?
Linux Mint 17 Cinnamon 32-bit, Dell Dimension 9200, 4GB, 2.4GHz Core2, Radeon X1300
User avatar
Taffman
Level 3
Level 3
 
Posts: 106
Joined: Fri May 06, 2011 10:51 am
Location: United Kingdom

Re: How to run commands on startup

Postby bigj231 on Wed Feb 20, 2013 1:53 pm

Did you set the script to executable?
Code: Select all
chmod 775 yourscriptnamehere
Running on a 4-slot toaster @ 60Hz
User avatar
bigj231
Level 5
Level 5
 
Posts: 793
Joined: Fri Feb 26, 2010 10:16 am
Location: Middle of Nowhere

Re: How to run commands on startup

Postby Taffman on Wed Feb 20, 2013 1:57 pm

Yep tried that still doesn't work.
Linux Mint 17 Cinnamon 32-bit, Dell Dimension 9200, 4GB, 2.4GHz Core2, Radeon X1300
User avatar
Taffman
Level 3
Level 3
 
Posts: 106
Joined: Fri May 06, 2011 10:51 am
Location: United Kingdom

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: Bing [Bot], glhallway, JeremyB, Mute Ant, niowluka and 34 guests