how to start a scripit when a given user logs in

If none of the more specific forums is the right place to ask

how to start a scripit when a given user logs in

Postby gablea » 2018-04-11 21:45

Hi everyone,
I am in the process of migrating my EPoS companys software to Linux and I would like a little advice

I have a EPoS terminal (NCR Dynakey) that boots into Debian 8 and logs in a PoSUser is it possible to start a scripit once the system has fully logged in so it can auto start the Point of sale sofware?

and if possible if I log in as admin all i get it is the normal CLI and the scripit would not run.


This is my scripit

Code: Select all
#!/bin/bash
# This scripit sets up the 10MB RAM drive for the data files and sets up the Data files Locations
# Then starts NPoS

# This section is hard coded with in the script. Change this are only to make it run on other
# PoS terminals

IP=192.168.1.199
NPoSLocation=/home/NPoS


echo Creating 10MB RAM Drive for the database files
   mouint -t tmpfs -o size=10m tmps /media/RAMDrive

echo Connecting to Network shares
   mount -t cifs -o username=posuser,password=posuser /$IP/PoS /media/PoSApp
   mount -t cifs -o username=posuser,password=posuser /$IP/ToPoS /media/FromServer
   mount -t cifs -o username=posuser,password=posuser /$IP/FromPoS /media/ToServer


echo starting NPoS Point of Sale...
cd $NPoSLocation
./NPoS


I hope someone can show me how to do this as this is the last part that is stopping us from fully migrating to Linux
gablea
 
Posts: 17
Joined: 2015-12-26 21:32

Re: how to start a scripit when a given user logs in

Postby Head_on_a_Stick » 2018-04-12 08:03

gablea wrote:I have a EPoS terminal (NCR Dynakey) that boots into Debian 8 and logs in a PoSUser is it possible to start a scripit once the system has fully logged in so it can auto start the Point of sale sofware?

User scripts can be run in several ways but your script calls `mount` and so requires root permissions, does your PoSUser have permission to mount devices?

If so then call the script from ~/.profile, that file is parsed when the user logs in.

If not then perhaps run the script as part of a custom systemd unit file with an associated .target and set the .target as the default to boot into; multi-user.target could then be used to log in as admin with a custom GRUB entry to select that.
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 7405
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to General Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable