autorun script
by kodirucu from LinuxQuestions.org on (#51G4K)
Hello. I can't start the script with autorun. What is the problem?
Used the following commands:
Code:chmod +x /root/scripts/gccscripts.sh
systemctl enable gsscripts.service
systemctl enable gsscripts
systemctl run gsscripts.service
systemctl run gsscriptsCode:[Unit]
Description=gcc
[Service]
Type=simple
ExecStart=/root/scripts/gccscripts.sh
[Install]
WantedBy=multi-user.targetCode:#!/bin/bash
function gcc_stepik()
{
local srcname="${1}.c";
local objname1="${1}";
local objname2="${1}";
cd /root/coding/stepik/c/ && gcc "$srcname" -lm -o "$objname1" && /root/coding/stepik/c/"$objname2";
}Code:a- gccscripts.service - gcc
Loaded: loaded (/etc/systemd/system/gccscripts.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-03-31 06:46:56 UTC; 28min ago
Process: 1821 ExecStart=/root/scripts/gccscripts.sh (code=exited, status=0/SUCCESS)
Main PID: 1821 (code=exited, status=0/SUCCESS)
Mar 31 06:46:56 code-server systemd[1]: Started gcc.
root@code-server:~#


Used the following commands:
Code:chmod +x /root/scripts/gccscripts.sh
systemctl enable gsscripts.service
systemctl enable gsscripts
systemctl run gsscripts.service
systemctl run gsscriptsCode:[Unit]
Description=gcc
[Service]
Type=simple
ExecStart=/root/scripts/gccscripts.sh
[Install]
WantedBy=multi-user.targetCode:#!/bin/bash
function gcc_stepik()
{
local srcname="${1}.c";
local objname1="${1}";
local objname2="${1}";
cd /root/coding/stepik/c/ && gcc "$srcname" -lm -o "$objname1" && /root/coding/stepik/c/"$objname2";
}Code:a- gccscripts.service - gcc
Loaded: loaded (/etc/systemd/system/gccscripts.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-03-31 06:46:56 UTC; 28min ago
Process: 1821 ExecStart=/root/scripts/gccscripts.sh (code=exited, status=0/SUCCESS)
Main PID: 1821 (code=exited, status=0/SUCCESS)
Mar 31 06:46:56 code-server systemd[1]: Started gcc.
root@code-server:~#