Custom systemd unit service giving error - why?
by ddenial from LinuxQuestions.org on (#5N2S2)
Hello All
I have created a custom system unit service as follows. The function of this service is to run a particular command AFTER I log in to my user account.
Code:$ mkdir -p ~/.config/systemd/user
$ cd ~/.config/systemd/user
$ vim resizeit.service
[Unit]
Description=Run resize command
[Service]
ExecStart=/usr/bin/resize
[Install]
WantedBy=default.target
$ systemctl --user enable resizeit.service
$ sudo rebootBut, after reboot, the service is not running. It is giving the following error.
Code:$ systemctl --user status resizeit
* resizeit.service - Run resize command
Loaded: loaded (/home/danial/.config/systemd/user/resizeit.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2021-08-08 01:19:05 IST; 2min 20s ago
Process: 2069 ExecStart=/usr/bin/resize (code=exited, status=1/FAILURE)
Main PID: 2069 (code=exited, status=1/FAILURE)
CPU: 1ms
Aug 08 01:19:05 lab.kvm systemd[2059]: Started Run resize command.
Aug 08 01:19:05 lab.kvm systemd[2059]: resizeit.service: Main process exited, code=exited, status=1/FAILURE
Aug 08 01:19:05 lab.kvm systemd[2059]: resizeit.service: Failed with result 'exit-code'.Can't figure it why?
Thanks
I have created a custom system unit service as follows. The function of this service is to run a particular command AFTER I log in to my user account.
Code:$ mkdir -p ~/.config/systemd/user
$ cd ~/.config/systemd/user
$ vim resizeit.service
[Unit]
Description=Run resize command
[Service]
ExecStart=/usr/bin/resize
[Install]
WantedBy=default.target
$ systemctl --user enable resizeit.service
$ sudo rebootBut, after reboot, the service is not running. It is giving the following error.
Code:$ systemctl --user status resizeit
* resizeit.service - Run resize command
Loaded: loaded (/home/danial/.config/systemd/user/resizeit.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2021-08-08 01:19:05 IST; 2min 20s ago
Process: 2069 ExecStart=/usr/bin/resize (code=exited, status=1/FAILURE)
Main PID: 2069 (code=exited, status=1/FAILURE)
CPU: 1ms
Aug 08 01:19:05 lab.kvm systemd[2059]: Started Run resize command.
Aug 08 01:19:05 lab.kvm systemd[2059]: resizeit.service: Main process exited, code=exited, status=1/FAILURE
Aug 08 01:19:05 lab.kvm systemd[2059]: resizeit.service: Failed with result 'exit-code'.Can't figure it why?
Thanks