I have made a startup_test.sh with the following contents
cd /home/xyz/Desktop/gnome-terminal -e "bash -c ./efg"
#desktop folder contains an executable named efg
.
If I run gnome-terminal -e "bash -c ./efg"
in terminal it just works fine. Opens a new terminal and program efg
is running correctly.I want to make this script startup_test.sh
run after bootup/login.
I am in a login which has root privileges.
chmod +x startup_test.shcp startup_test.sh /usr/sbin/
My startup_test.service
has the following contents:
[Unit]Description=ABC[Install]WantedBy=multi-user.target[Service]ExecStart=/usr/sbin/startup_test.shWorkingDirectory=/home/xyz/Desktop/startupStandardOutput=syslogStandardError=syslogSyslogIdentifier=%n
startup_test.service
is placed in /etc/systemd/system
folder.
Now the command
systemctl daemon-reload
is run.No output.
Now the command systemctl enable startup_test.service
is giving the following output:
Failed to enable unit : Invalid argument
What is the cause of the above output.
the command systemctl start startup_test.service
is giving no output.
The command systemctl status startup_test.service
is giving:
startup_test.service - ABC Loaded: loaded (/etc/systemd/system/startup_test.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2024-02-19 12:09:20 IST; 2min 55s ago Process: 32531 ExecStart=/usr/sbin/startup_test.sh (code=exited, status=203/EXEC) Main PID: 32531 (code=exited, status=203/EXEC)Feb 19 12:09:20 localhost.localdomain systemd[1]: Started ABC.Feb 19 12:09:20 localhost.localdomain systemd[1]: startup_test.service: Main process exited, code=exited, status=203/EXECFeb 19 12:09:20 localhost.localdomain systemd[1]: startup_test.service: Failed with result 'exit-code'.
OS is redhat 8.2