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
5
  • 2
    Welcome to the site. In general, the behaviour of files under Linux is not determined by their extension, but by whether or not they have the "executable" bit set in their permissions; see here for example. Hence, most executables simply have no suffix at all. You will need admin access if you want to copy a file to any of the system-wide default directories for executable binaries, but if you want to run it as an ordinary user, you can just copy the file to that user's home directory (or a suitable sub-directory).
    – AdminBee
    May 6 '20 at 15:02
  • 2
    Dear Arvind, in linux there is no such thing as an extension for an executable. There is no need to have admin to run the file. Maybe by installable file you are referring to rpm or deb package?
    – GMaster
    May 6 '20 at 15:02
  • 2
  • @GMaster - I want to install long running service which sending mails(or nunning) to the users every day at 7AM,12PM,3PM and 5PM EST. May 6 '20 at 16:18
  • @AdminBee - Thanks for your input. May 6 '20 at 16:19
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.

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.

1
  • Please check my updated question. So are you saying there s no extesion for bg long service. May 6 '20 at 16:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.