LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-11-2013, 01:07 AM   #1
Djyou
LQ Newbie
 
Registered: Jun 2013
Distribution: Whatever works for the job.
Posts: 25

Rep: Reputation: Disabled
How to make a script run on any login. X/K Ubuntu


I have a script that is supposed to run whenever any user logs in whether in GUI or CLI.

Code:
#! /bin/bash
# Voice synth'ed welcome script

## If earlier than 05:30
 if [ "$(date '+%H%M')" -lt 0530 ]; then
espeak -s 140 -ven-us+f4 "Why are you up this early $USER ?"
fi
## If bewteen 05:30 and 12:00
if [ "$(date '+%H%M')" -gt 0530 -a $(date "+%H%M") -lt 1200 ]; then
espeak -s 140 -ven-us+f4 "Good morning, $USER"
fi
## If between 12:00 and 21:30
if [ "$(date '+%H%M')" -gt 1200 -a "$(date '+%H%M')" -lt 2130 ]; then
espeak -s 140 -ven-us+f4 "Good afternoon, $USER"
fi
## If later than 21:30
if [ "$(date '+%H%M')" -gt 2130 ]; then
espeak -s 140 -ven-us+f4 "Hello $USER, are you sure you should be logging in at this time?"
fi
Where would I put it/what would I change to make it run whenever any user logged in wether in GUI or CLI?
I have two machines on xubuntu and one kubuntu that I would like to do this one is the process the same on both?

As always thanks in advance

--Djyou
 
Old 06-11-2013, 03:28 AM   #2
shm0
Member
 
Registered: Aug 2012
Location: Bahrain
Distribution: Slackware
Posts: 58

Rep: Reputation: 16
Quote:
Originally Posted by Djyou View Post
Where would I put it/what would I change to make it run whenever any user logged in wether in GUI or CLI?
I have two machines on xubuntu and one kubuntu that I would like to do this one is the process the same on both?
For CLI see here. And for any GUI, see here.
 
  


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
Make OpenVPN connect on Ubuntu startup and then when connected, run a script as su riahc3 Linux - Networking 3 10-05-2012 09:01 PM
Ubuntu How to run Python script on Login? warnetgm Linux - General 14 03-13-2012 06:11 PM
[SOLVED] How do I make a script run once upon first time login? Karas Linux - Newbie 4 11-22-2009 02:06 PM
How do I make a simple script and make it run on bootup?? coolblue Programming 5 12-18-2006 09:55 PM
how do i make a script run on login? roseplant SUSE / openSUSE 11 01-24-2006 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:14 AM.

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