Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

how to start a scripit when a given user logs in

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
gablea
Posts: 56
Joined: 2015-12-26 21:32
Location: United Kingdom

how to start a scripit when a given user logs in

#1 Post by gablea »

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

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

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

#2 Post by Head_on_a_Stick »

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.
deadbang

Post Reply