LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-31-2020, 06:02 AM   #1
kodirucu
LQ Newbie
 
Registered: Mar 2020
Posts: 2

Rep: Reputation: Disabled
autorun script


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 gsscripts
Code:
[Unit]
Description=gcc

[Service]
Type=simple
ExecStart=/root/scripts/gccscripts.sh 

[Install]
WantedBy=multi-user.target
Code:
#!/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:
● 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:~#
 
Old 03-31-2020, 06:36 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by kodirucu View Post
systemctl enable gsscripts.service
Shouldn't it be gccscripts.service?
 
1 members found this post helpful.
Old 03-31-2020, 03:12 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by kodirucu View Post
Code:
systemctl enable gsscripts.service
systemctl enable gsscripts
systemctl run gsscripts.service
systemctl run gsscripts
These commands should have returned something.
Please show us what they return.
Most notably, "run" does not exist for systemctl. Did you not get this message:
Code:
Unknown operation run.
???
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Make a autorun USB that executes a shell script on the USB drive? riahc3 Linux - Newbie 47 08-23-2012 02:14 AM
Which style for autorun script is better: prompt console(.sh) or GUI(.py) Weining Linux - Software 3 09-25-2009 05:20 PM
Autorun Backup script before shutdown!!!!! jp286 Linux - Networking 1 11-25-2008 10:29 AM
any way I can autorun a script before when shutdown Niceman2005 Linux - General 4 03-03-2006 05:40 PM
Autorun.sh script to mount CD and run .bin file kulkarni08 Linux - General 2 06-24-2003 01:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration