Sponsored Content
Top Forums UNIX for Dummies Questions & Answers look for users to be looged on or off Post 302138919 by ladytwo on Wednesday 3rd of October 2007 10:59:02 PM
Old 10-03-2007
look for users to be looged on or off

what am i doing wrong here's code. i have a file that has names of users and i want to know when they log on and off.Smilie

while true
do
for X in "friends1"
do
if who | grep "$X"
then
echo "$X is logged in"
else
sleep 5
fi

echo who > on
if [ $X -ne on]
then
echo "$X is logged off"
else
else sleep 5
fi
done
done
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

no of users

Is there any way to find the number of unique users in a system other than who | cut -d" " -f1 | sort -u | wc -l ? (3 Replies)
Discussion started by: asutoshch
3 Replies

2. Solaris

do i need these users?

uucp:x:5:5:uucp Admin:/usr/lib/uucp: nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico smmsp:x:25:25:SendMail Message Submission Program:/: listen:x:37:4:Network Admin:/usr/net/nls: nobody:x:60001:60001:Nobody:/: noaccess:x:60002:60002:No Access User:/:... (3 Replies)
Discussion started by: csaunders
3 Replies

3. HP-UX

Users

Is there a command to tell what applications certain users ran in past few months? And thier last login? This is on HPUX machine Thanks! (1 Reply)
Discussion started by: catwomen
1 Replies

4. HP-UX

Limiting SFTP Users While Not Limiting Regular Users?

Hi, I have searched the web and have come back with nothing that is satisfactory for what I require. SFTP is my corporations new file transfer standard. What I require is a method to lock down SFTP users to their directory (they may go to sub directories) while not restricting regular users. ... (2 Replies)
Discussion started by: Emancipator
2 Replies

5. Solaris

To restrict the users not to change the passwords for NIS users

Hi All, How to restrict the NIS users not to change their passwords in for NIS users?? and my NIS user is unable to login to at client location what could be the problem for this ? Any body can help me. Thanks in advance. (1 Reply)
Discussion started by: Sharath Kumar
1 Replies

6. Red Hat

Showing all users in 'users' and 'top' commands

Hi All, I work in a multi user environment where my school uses Red Hat Linux server. When I issue commands such as "top" or "users", I get to see what others are doing and what kinds of applications they are running (even ps -aux will give such information). "users" will let me know who else is... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. Red Hat

users cannot switch with "su" to another users

Hi, i have a problem, itīs because users without belonging wheel group cannot switch to another user , when the password is introduced says not right password. The only solution for now is to add them to wheel users, but then i have another problem, they can login as root. Is there any... (3 Replies)
Discussion started by: pabloli150
3 Replies

8. Shell Programming and Scripting

Create multiple users with individual passwords to users

hi, i am new to shell scripts i write a shell script to create multiple users but i need to give passwords to that users while creating users, command to write this script (1 Reply)
Discussion started by: DONFOX
1 Replies
BOOLVAL(3)								 1								BOOLVAL(3)

boolval - Get the boolean value of a variable

SYNOPSIS
boolean boolval (mixed $var) DESCRIPTION
Returns the boolean value of $var. PARAMETERS
o $var - The scalar value being converted to a boolean. RETURN VALUES
The boolean value of $var. EXAMPLES
Example #1 boolval(3) examples <?php echo '0: '.(boolval(0) ? 'true' : 'false')." "; echo '42: '.(boolval(42) ? 'true' : 'false')." "; echo '0.0: '.(boolval(0.0) ? 'true' : 'false')." "; echo '4.2: '.(boolval(4.2) ? 'true' : 'false')." "; echo '"": '.(boolval("") ? 'true' : 'false')." "; echo '"string": '.(boolval("string") ? 'true' : 'false')." "; echo '"0": '.(boolval("0") ? 'true' : 'false')." "; echo '"1": '.(boolval("1") ? 'true' : 'false')." "; echo '[1, 2]: '.(boolval([1, 2]) ? 'true' : 'false')." "; echo '[]: '.(boolval([]) ? 'true' : 'false')." "; echo 'stdClass: '.(boolval(new stdClass) ? 'true' : 'false')." "; ?> The above example will output: 0: false 42: true 0.0: false 4.2: true "": false "string": true "0": false "1": true [1, 2]: true []: false stdClass: true SEE ALSO
floatval(3), intval(3), strval(3), settype(3), is_bool(3), Type juggling. PHP Documentation Group BOOLVAL(3)
All times are GMT -4. The time now is 07:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy