Sponsored Content
Top Forums Shell Programming and Scripting shell script that will automatically check if specifed user is log in or not, in 30 seconds Post 302375178 by gurmad on Thursday 26th of November 2009 08:54:14 PM
Old 11-26-2009
shell script that will automatically check if specifed user is log in or not, in 30 seconds

guys I need emergency help with below shell script assignment..am new to shell script

Write a Shell script to automatically check that a specified user is logged in to the
computer.
The program should allow the person running the script to specify the name of the
user to be checked, the frequency in seconds at which the script should check. If a
checking frequency is not specified, it should default to 60 seconds
The script should check for the specified user and if found should output a message
with a “beep” or “bell” sound to the screen stating that the user is logged in. It should
also output a message to a log file stating that the user is logged in and specifying the
date and time.
If the user is not logged in the script should output a message without any “beep”
sound to the screen stating that the user is not logged in.
The script should allow a person running the script to specify the user name on the
command line and optionally, a check frequency in seconds and a third argument “q”
“q” . If “q” is present as a third argument, The script should omit any output to the
screen or “beep” sound but should log to a log file the message stating that the user is
logged in and giving the time.
The command to run the script would be as follows:
checklogin username 30 q where “checklogin” is the script name, “username” is the
name of the user, “30” is the optional frequency to check in seconds, and “q” is the
optional argument to suppress screen output.
The script should check that the number of arguments supplied is between 1 and 3 and
if it is not, should terminate with an error message showing the correct syntax for the
command.
You will be required to make a demonstration in the lab on how your program is
working. You will be required to produce a printed copy of your shell on the same
day. After your demonstration , make a directory in your home directory called
“assignment” and copy your shell script program to it. Give your program a unique
name beginning with your username ‘usernamelinuxshell' Your name, student
number and course you are taking must appear at the top of your program. It is
important to make sure that the program is fully documented.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help to write script to check the process health and automatically restart it

I am working on a project, which need to constantly watch the process, and check its status, if it was dead, it should be restart automatically. Please kindly refer me to URL which teach how to write this kind of script, or service. Thanks. (1 Reply)
Discussion started by: dragondad
1 Replies

2. Shell Programming and Scripting

wait for 5 seconds in shell script

hi how can i wait for 5 seconds inside my shell script? 'wait 5' command doesnot seem to be working? (2 Replies)
Discussion started by: gopsman
2 Replies

3. Shell Programming and Scripting

Script to automatically check ports in shell?

Good day, I'm new to linux environment...Is there any scripts available for me to check ports (lets say port 80 and 21) through shell with just a single commandline? Any response is very much appreciated.. thanks (4 Replies)
Discussion started by: arsonist
4 Replies

4. Shell Programming and Scripting

shell script for primary and standby DB archive log check

Hi All, OS:AIX 5.3 64 bits I would like the below script to send alert mail with the message - "Standby logs falling behind Primary" to xyz@yahoo.com Script ===== #!/usr/bin/ksh #----------------------------------------------------------------------------- # Use SQL*Plus to query... (1 Reply)
Discussion started by: a1_win
1 Replies

5. Shell Programming and Scripting

Exit script if the user dosent enter any data within 5 seconds

Hello friends, Kindly help me in developing a script that asks user to enter a value and will wait for 5 seconds for the feedback. If there is no answer from the user the script will perform exit or it will continue doing something else Ex: If yu have a multi OS system i believe while... (3 Replies)
Discussion started by: frozensmilz
3 Replies

6. Shell Programming and Scripting

Shell script to log into another user

Hi i have not don anny scripting before so pls answer simple:) I want to make a shell script that i can use to execute a program on a nother pc. They are both using CentOS. The command i use to execute to program from my computer is: First i open a terminal and write: #ssh -X gw302 (i... (4 Replies)
Discussion started by: fkildal
4 Replies

7. Shell Programming and Scripting

execute the shell script per ten seconds

hi, everyone. My want to execute the shell script below per 10 seconds PID=`pgrep java` if then /home/java/java fi crontab wouldn't help me. some one can give me suggestions?thanks ---------- Post updated at 07:29 AM ---------- Previous update was at 07:26 AM ---------- ... (6 Replies)
Discussion started by: AKB48
6 Replies

8. Shell Programming and Scripting

How to write a shell script to automatically accept return key with out user intervention?

Hi Friends, i am creating a shell script which is accepting file name as input parameter from Java and invoking finacle service. The service will accpet text file,B2k_session id,etc and upload the text file data in finacle database. My shell script looks like this:- #! /bin/ksh... (2 Replies)
Discussion started by: vadlamudy
2 Replies

9. Shell Programming and Scripting

How to run script automatically on reboot as root user?

Hi friends,,, I am running one server on Ubuntu 12.04 LTS 32-bit, some times my pc restarts automatically, with no reason, I have a script to start server which requires root password. in this directory /myserver/start_server.sh How can I do this ? and some scripts I am having that I... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

10. Shell Programming and Scripting

How to check the user input to be valid using shell script?

How to check the user input to be valid using shell script? The valid input is in the format like as follows. 1. It can only have r,w,x or a hyphen and nothing else. 2. ensure the r, w, x are in the correct order. for example: rwxr-xr-x is a valid format. Thanks (5 Replies)
Discussion started by: hyeewang
5 Replies
merge_fonts(3alleg4)						  Allegro manual					      merge_fonts(3alleg4)

NAME
merge_fonts - Merges two fonts into one font. Allegro game programming library. SYNOPSIS
#include <allegro.h> FONT *merge_fonts(FONT *f1, FONT *f2) DESCRIPTION
This function merges the character ranges from two fonts and returns a new font containing all characters in the old fonts. In general, you cannot merge fonts of different types (eg, TrueType fonts and bitmapped fonts), but as a special case, this function can promote a mono- chrome bitmapped font to a color font and merge those. Example: FONT *myfont; FONT *myfancy_font; FONT *lower_range; FONT *upper_range; FONT *capitals; FONT *combined_font; FONT *tempfont; ... /* Create a font that contains the capitals from */ /* the fancy font but other characters from myfont */ lower_range = extract_font_range(myfont, -1, 'A'-1); upper_range = extract_font_range(myfont, 'Z'+1, -1); capitals = extract_font_range(myfancy_font, 'A', 'Z'); tempfont = merge_fonts(lower_range, capitals); combined_font = merge_fonts(tempfont, upper_range); /* Clean up temporary fonts */ destroy_font(lower_range); destroy_font(upper_range); destroy_font(capitals); destroy_font(tempfont); RETURN VALUE
Returns a pointer to the new font or NULL on error. Remember that you are responsible for destroying the font when you are finished with it to avoid memory leaks. SEE ALSO
extract_font_range(3alleg4), is_trans_font(3alleg4), is_color_font(3alleg4), is_mono_font(3alleg4), exfont(3alleg4) Allegro version 4.4.2 merge_fonts(3alleg4)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy