-
Notifications
You must be signed in to change notification settings - Fork 0
/
myjob.sh
executable file
·83 lines (59 loc) · 1.49 KB
/
myjob.sh
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
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env bash
#SBATCH -J jobname
# Stop execution after any error
set -e
# Cleanup function to be executed upon exit, for any reason
function cleanup() {
rm -rf $WORKDIR
}
########################################
#
# Useful variables
#
########################################
# Your user name
# (Don't change this)
MYUSER=$(whoami)
# Path of the local storage on a node
# Use this to avoid sending data streams over the network
# (Don't change this)
LOCALDIR=/local
# Folder where you want your data to be stored
# (Adapt this to your needs)
DATADIR=~/data
########################################
#
# Job-related variables
#
########################################
# Parameters related to this job
# (Use better names than these placeholders)
PARAM1=$1
PARAM2=$2
# Job id
# (Change this to reflect the above parameters)
THISJOB=${PARAM1}_${PARAM2}
# Job working directory
# (Don't change this)
WORKDIR=$LOCALDIR/$MYUSER/$THISJOB
########################################
#
# Job directory
#
########################################
# Create work dir from scratch, enter it
# (Don't change this)
rm -rf $WORKDIR && mkdir -p $WORKDIR && cd $WORKDIR
# Make sure you cleanup upon exit
# (Don't change this)
trap cleanup EXIT SIGINT SIGTERM
########################################
#
# Actual job logic
#
########################################
# Execute job
# (Your commands go here)
# Transfer generated *.dat files into home directory
# (Adapt this to your data files)
cp -a *.dat $DATADIR