Answer the question
In order to leave comments, you need to log in
How is the correct autoload in Ubuntu done on behalf of the user?
Greetings!
Tell me, let's say there is a fresh Ubuntu system and a certain user with the rights of a regular user.
How to autoload some bash scripts on his behalf at system startup?
So that if, for example, the server reboots, it all starts up, even if the user himself has not logged into the system yet.
There, in the scripts, some software is launched in Java in daemon mode and listens to some ports, the software itself is located in the [~] user-a directory, but this is not important.
Please do not offer Docker as a solution to this issue.
Answer the question
In order to leave comments, you need to log in
How to autoload some bash scripts on his behalf at system startup?
sudo crontab -eu root
@reboot /bin/sudo -u username /path/to/your/script.sh
Ubuntu has systemd for system process management.
you write a unit for the control system to run your program on behalf of the desired user. for example
/etc/systemd/system/3proxy.proxy.service
[Unit]
Description=Simple proxy (3proxy) service
After=network.target
[Service]
User=nobody
Group=nogroup
ExecStart=/usr/bin/proxy -l/var/log/1pfg/3proxy.log -4 -p10021
[Install]
WantedBy=multi-user.target
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question