I want to run a simple command after my ubuntu starts up and network services are established (it should do so no matter wheater I'm logged in or not)
If I run the command manually, it start's up the enclosed applications: confluent local services start
. So it works at least with my user.
Questions:
- How can I run the command on system startup (after network is esablished)?
- To any solutions suggested, how can I monitor if the solution really executes?
What I've tried so far:
crontab: sudo crontab e
and added @reboot confluent local services start
. This line is erased every time I reboot the system.
system service: I've added the command to a sh script under /usr/local/bin/confluent-startup.sh. Then I've created the service file in /etc/systemd/system/confluent-local.service
This file would hold the following content:
[Unit]
Description=starting local confluent
After=network.service
[Service]
ExecStart=/usr/local/bin/confluent-local-start.sh
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
I've reloaded the services
sudo systemctl daemon-reload
sudo systemctl enable confluent-local.service
After rebooting, I see the service enabled invoking: systemctl list-unit-files --type service -all
. But running confluent local services status
would show me that all services are still down. Why does it work manually but not with systemd? (FYI: I've change rights on the service and on the script to full access: 777 (yes, I know... It's just for testing))
Any clue?