2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 19:07:33 +00:00

use USER env variable

issue #13
This commit is contained in:
Nihad Abbasov 2015-11-24 03:46:12 +04:00
parent a4c4c5ec2c
commit e031c73e3a
5 changed files with 9 additions and 9 deletions

View File

@ -3,8 +3,8 @@
# Skip on weekends
exit if Time.now.saturday? || Time.now.sunday?
# Exit early if no sessions with my_username are found
exit if `who`[/my_username/].nil?
# Exit early if no sessions with my username are found
exit unless `who -q`.include? ENV['USER']
require 'net/telnet'

View File

@ -10,8 +10,8 @@ Dir.mkdir('logs') unless File.exists?(log_file_name)
LOG_FILE = File.open(log_file_name, 'a+')
# Exit early if sessions with my_username are found
exit unless `who`[/my_username/].nil?
# Exit early if sessions with my username are found
exit if `who -q`.include? ENV['USER']
require 'dotenv'
require 'twilio-ruby'

View File

@ -7,7 +7,7 @@ if [ "$DAYOFWEEK" -eq 6 ] || [ "$DAYOFWEEK" -eq 7 ]; then
exit
fi
# Exit early if any session with my_username is found
# Exit early if any session with my username is found
if who | grep -wq $USER; then
exit
fi

View File

@ -7,8 +7,8 @@ if [ "$DAYOFWEEK" -eq 6 ] || [ "$DAYOFWEEK" -eq 7 ]; then
exit
fi
# Exit early if no sessions with my_username are found
if ! who | grep -wq 'my_username'; then
# Exit early if no sessions with my username are found
if ! who | grep -wq $USER; then
exit
fi

View File

@ -10,8 +10,8 @@ Dir.mkdir('logs') unless File.exists?(log_file_name)
LOG_FILE = File.open(log_file_name, 'a+')
# Exit early if no sessions with my_username are found
exit if `who`[/my_username/].nil?
# Exit early if no sessions with my username are found
exit if `who -q`.include? ENV['USER']
require 'dotenv'
require 'twilio-ruby'