forked from plus3it/amigen7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActiveTmp.sh
executable file
·47 lines (46 loc) · 1.05 KB
/
ActiveTmp.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
#!/bin/sh
# shellcheck disable=SC2181
#
# Script to ensure that host has /tmp as tmpfs
#
#################################################################
SVCNAM="tmp.mount"
TMPSVC=$(systemctl is-enabled ${SVCNAM})
case ${TMPSVC} in
masked)
systemctl unmask ${SVCNAM} && \
systemctl enable ${SVCNAM} && \
systemctl start ${SVCNAM}
if [ $? -eq 0 ]
then
echo "/tmp mounted as tmpfs"
exit 0
else
echo "Failed to mount /tmp as tmpfs." > /dev/stderr
exit 1
fi
;;
disabled)
systemctl enable ${SVCNAM} && \
systemctl start ${SVCNAM}
if [ $? -eq 0 ]
then
echo "/tmp mounted as tmpfs"
exit 0
else
echo "Failed to mount /tmp as tmpfs." > /dev/stderr
exit 1
fi
;;
enabled)
systemctl restart ${SVCNAM}
if [ $? -eq 0 ]
then
echo "/tmp mounted as tmpfs"
exit 0
else
echo "Failed to mount /tmp as tmpfs." > /dev/stderr
exit 1
fi
;;
esac