-
Notifications
You must be signed in to change notification settings - Fork 1
/
trd_dance.bash
executable file
·71 lines (63 loc) · 2.43 KB
/
trd_dance.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
# Copyright (c) 2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by Geoff Cleary <gcleary@llnl.gov>.
# LLNL-CODE-734257
#
# All rights reserved.
# This file is part of Tour Robot Dance. For details, see
# https://github.com/LLNL/TourRobotDance. Licensed under the
# Apache License, Version 2.0 (the “Licensee”); you may not use
# this file except in compliance with the License. You may
# obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the license.
exec_dir="/usr/bin"
special_file="/scratch/acsss/trd_keepgoing"
core=$(${exec_dir}/nodeattr -v hpss_core)
zone=$(${exec_dir}/nodeattr -v archive_zone)
#
## Preflight checks
if [[ $core != "prodprim" ]]
then
printf "\n\tThis only runs on the production core server.\n\n"
exit 1
fi
if [[ $EUID != 0 ]]
then
printf "\n\tYou must be root.\n\n"
exit 1
fi
if [[ $1 == "--start" ]] || [[ $1 == "-s" ]] # Start the robot dance
then
if [[ -e $special_file ]]
then
printf "\n\tThe robot dance is already running.\n\n"
exit 1
else
touch $special_file
${exec_dir}/run_hpssmsg alarm warning "The B453 Tour Robot Dance (TRD) has begun. Remember to stop it with the 'trd_dance --stop' command."
${exec_dir}/logger -s -t $(basename $0) -p user.info "The B453 Tour Robot Dance has begun. Remember to eventually stop it with the 'trd_dance --stop' command."
fi
elif [[ $1 == "--stop" ]] || [[ $1 == "-t" ]] # Stop the robot dance
then
if [[ -e $special_file ]]
then
rm $special_file
${exec_dir}/run_hpssmsg alarm warning "The B453 Tour Robot Dance (TRD) will start winding down now. It will be a few minutes before it has completely stopped."
${exec_dir}/logger -s -t $(basename $0) -p user.info "The B453 Tour Robot Dance (TRD) will start winding down now. It will be a few minutes before it has completely stopped."
else
printf "\n\tThe robot dance isn't running.\n\n"
exit 1
fi
else
printf "\n\tUsage: $(basename $0) [--start|--stop]\n\n"
exit 1
fi
exit 0