-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
108 lines (89 loc) · 2.4 KB
/
init.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
. "/etc/parallelcluster/cfnconfig"
case "${cfn_node_type}" in
MasterServer)
echo "I am the head node"
systemctl stop slurmctld
dpkg --configure -a
apt update
apt install -y mysql-server
systemctl restart mysql
mysql -e "CREATE DATABASE slurm_acct_db;"
mysql -e "CREATE USER 'slurm'@'localhost' IDENTIFIED BY 'password';"
mysql -e "GRANT ALL ON slurm_acct_db.* TO 'slurm'@'localhost';"
adduser slurm syslog
mkdir /var/log/slurm
chmod g+rw /var/log/slurm
chgrp syslog /var/log/slurm
echo """
[Unit]
Description=Slurm DB controller daemon
After=network.target munge.service
ConditionPathExists=/opt/slurm/etc/slurmdbd.conf
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/slurmdbd
ExecStart=/opt/slurm/sbin/slurmdbd $SLURMDBD_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/var/run/slurmdbd.pid
LimitNOFILE=562930
LimitMEMLOCK=infinity
LimitSTACK=infinity
[Install]
WantedBy=multi-user.target
""" > /etc/systemd/system/slurmdbd.service
echo """
ArchiveEvents=yes
ArchiveJobs=yes
ArchiveResvs=yes
ArchiveSteps=no
ArchiveSuspend=no
ArchiveTXN=no
ArchiveUsage=no
AuthType=auth/munge
DbdHost=localhost
DbdPort=6830
DebugLevel=info
PurgeEventAfter=1month
PurgeJobAfter=12month
PurgeResvAfter=1month
PurgeStepAfter=1month
PurgeSuspendAfter=1month
PurgeTXNAfter=12month
PurgeUsageAfter=24month
LogFile=/var/log/slurmdbd.log
PidFile=/var/run/slurmdbd.pid
SlurmUser=slurm
StorageType=accounting_storage/mysql
StorageUser=slurm
StoragePass=password
StorageHost=localhost
StoragePort=3306
""" > /opt/slurm/etc/slurmdbd.conf
sed -i '/include slurm_parallelcluster.conf/d' /opt/slurm/etc/slurm.conf
echo """
NodeName=DEFAULT RealMemory=15000
JobAcctGatherType=jobacct_gather/linux
AccountingStorageType=accounting_storage/slurmdbd
AccountingStorageHost=localhost
AccountingStorageUser=slurm
AccountingStoragePort=6830
AccountingStoreJobComment=YES
JobCompType=jobcomp/filetxt
JobCompLoc=/var/log/slurm/job_completions
include slurm_parallelcluster.conf
""" >> /opt/slurm/etc/slurm.conf
systemctl restart slurmdbd
sleep 10
systemctl restart slurmctld
sleep 60
systemctl stop slurmctld
sleep 60
systemctl restart slurmctld
;;
ComputeFleet)
echo "I am a compute node"
;;
*)
;;
esac