diff --git a/fucking_coffee.rb b/fucking_coffee.rb index 20af268..20e37d6 100755 --- a/fucking_coffee.rb +++ b/fucking_coffee.rb @@ -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' diff --git a/hangover.rb b/hangover.rb index 3d23564..2bc4053 100755 --- a/hangover.rb +++ b/hangover.rb @@ -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' diff --git a/hangover.sh b/hangover.sh index bd211ec..fb3b724 100755 --- a/hangover.sh +++ b/hangover.sh @@ -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 diff --git a/smack-my-bitch-up.sh b/smack-my-bitch-up.sh index f926e4f..b0bf6b1 100755 --- a/smack-my-bitch-up.sh +++ b/smack-my-bitch-up.sh @@ -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 diff --git a/smack_my_bitch_up.rb b/smack_my_bitch_up.rb index f59332c..8cddd7d 100755 --- a/smack_my_bitch_up.rb +++ b/smack_my_bitch_up.rb @@ -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'