0

I have developed a project/service which will give me installable file for linux m/c.

service: Which always run in background if machine is on. Linux background processes.

Just I want to know what is the extension of that file. Like Windows service has .exe extension?

Do we need admin access on linux machine to install that file?

I probably use below commands

[Unit]  
Description=Dotnet Core Demo service  

[Service]  
ExecStart=/bin/dotnet/dotnet Service.Sample.dll  
WorkingDirectory=/etc/SampleService/  
User=dotnetuser  
Group=dotnetuser  
Restart=on-failure  
SyslogIdentifier=dotnet-sample-service  
PrivateTmp=true  

[Install]  
WantedBy=multi-user.target

2 Answers2

1

The extension doesn't matter. In order for the file to be executable, it needs to have the executable permission bit set for whoever is trying to run it or else it has to be used as an argument for the binary of the language or shell that it is to run under.

For the first example, with the execute permissions set:

Current directory:

./installed_file

Any other directory:

/path/to/installed_file

Without the execute permission set:

bash installed_file

python /path/to/installed_file

The last two execute the file with Bash or Python.

If you are trying to install it with a package manager such as yum, dnf, rpm, apt, dpkg, zypper, pacman, then you'll need sudo, or as you call it, admin.

The same is true if you are going to create it otherwise and place it in a directory where only root has write ability such as /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, /opt/, etc.

Nasir Riley
  • 11,422
1

The code that starts with [Unit] is a systemd service file. When you distribute your package, you need to use means specific to the package system, be it dpkg, RPM or something else, to put the service file into the appropriate directory (most likely /usr/lib/systemd/system) and have it autostarted according to the [Install] section (systemctl enable). Refer to the documentation of systemd and of the package system in question.

The extension of the service file must be .service.