You are not logged in.

#1 2022-04-01 18:15:44

Bestinbest
Member
Registered: 2020-11-28
Posts: 35

[SOLVED] Error on executing a task after boot

Hello,

I recently tried to create a code to automatically kill task taking 100% of one of the cores of my processor.

Here is what I am using :

/etc/systemd/system/tueur.service :

[Unit]
Description=Tuons bootctl-random-seed qui prends 100% d'un des coeurs du processeur

[Service]
Type=simple
ExecStart=/usr/local/bin/tueur

[Install]
WantedBy=multi-user.target

/etc/systemd/system/tueur.timer :

[Unit]
Description=Lance le script tueur 1 min après le démarrage
[Timer]
OnBootSec=1min
[Install]
WantedBy=timers.target

/usr/local/bin/ :

sudo pkill -9 bootctl

But when I boot, nothing happens and I have to kill the task manually.
when typing

journalctl -xe

in my terminal, I see the following error occured :

tueur.service: Failed to execute /usr/local/bin/tueur: Exec format error

Does anyone knows where does it come from ? Maybe is because of the sudo, or is it something else I did wrong? I have a very basic understanding of all of this...

Last edited by Bestinbest (2022-04-01 19:15:52)

Offline

#2 2022-04-01 19:01:31

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,658
Website

Re: [SOLVED] Error on executing a task after boot

The real question would be why bootctl is hogging your CPU.
As for the script, it's missing a shebang.
And since you run the service as root, the call to sudo is pretty useless.

Last edited by schard (2022-04-01 19:03:51)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#3 2022-04-01 19:15:06

Bestinbest
Member
Registered: 2020-11-28
Posts: 35

Re: [SOLVED] Error on executing a task after boot

Yes I know I have to search for that problem, but right now I have a competitive exam in a few weeks so I don't really have time to spend on that. I guess I'll do my research this summer x).
Anyway, thanks for the reply, I was sure it was something as simple as that.

Have a nice day.

Offline

Board footer

Powered by FluxBB