How to run commands on startup
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
How to run commands on startup
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?
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?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: How to run commands on startup
Try /etc/init.d/rc.local ?
Russell.
Russell.
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
Re: How to run commands on startup
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.
Re: How to run commands on startup
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.
Re: How to run commands on startup
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.
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.
Re: How to run commands on startup
OK this is what I would try:
Make a shell script from the commands you want to run:
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
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.
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
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 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.
Re: How to run commands on startup
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?
Anyone know the trick to this?
Re: How to run commands on startup
Did you set the script to executable?
Code: Select all
chmod 775 yourscriptnamehere
Re: How to run commands on startup
for those looking here for a solution:
Open the "Session and Startup" application.
Go to the "Application Autostart" tab.
Add each command as a separate entry.
Done.
Open the "Session and Startup" application.
Go to the "Application Autostart" tab.
Add each command as a separate entry.
Done.
Re: How to run commands on startup
try /path/to/setserial on each of those lines in /etc/rc.local or in the script if one is used for it in /etc/rc.localTaffman wrote:Nope, that didn't work either.
Re: How to run commands on startup
Thank you! I was looking at this post for a solution. This worked really well for me. Much appreciated