Linux MintThis forum is for the discussion of Linux Mint.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello,
I'm trying to start a script with root permissions upon boot, but everything i tried so far isn't working.
First, I tried using crontab with @reboot option. Then i tried using /etc/init.d technique, but I'm not seeing the process running.
To give you little more information about the specific steps:
1) Created script called test.sh
Code:
#! /bin/bash
i=$1
while [ $i lt 100 ]
do
echo "Script running"
i=$[$i +1]
sleep 2
done
2) sudo chmod +x test.sh
3) Created startup.sh under /etc/init.d/
Yes, you are right! It was a typo, i have no issue with the script it self, but still trying to figure out how to start the script at boot with root privileges.
The @reboot works - but you need to look at the logs to see what happened.
One of the potential issues depends on whether you are using systemd or not, and how /home or /home/mist are mounted.
In some cases the cron service starts before the network is ready... and that could mean that NFS mounts haven't been done yet. What I'm not sure of is whether even all the local mounts have been done yet. I think they are supposed to have been completed, but don't know for sure.
I don't have anything running Mint at the moment but @reboot does work on my systems that do use systemd.
You can verify that your entry is actually added by looking roots /var/spool/cron/crontabs file. Also make sure that you have a line feed character at the end of the entry. Go back and edit the crontab, move the cursor to the end of the line and press the enter key. Save crontab.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.