Score:1

Fail to execute command on startup

de flag

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?

PonJar avatar
in flag
What do you get from “systemctl status confluent-local.service”?
feder avatar
de flag
@PonJar confluent-local.service - starting local confluent Loaded: loaded (/etc/systemd/system/confluent-local.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2021-10-10 09:51:11 UTC; 1h 7min ago Main PID: 648 (code=exited, status=203/EXEC) status=203: often execute if script is not executable?!? https://unix.stackexchange.com/questions/472950/systemd-status-203-exec-error-when-creating-new-service
PonJar avatar
in flag
It’s generally better to add this kind of output to your question. Looks like you have clues to a fix. If you solve it you can answer your own question which will help others in the future. Let us know how you get on
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.