-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcremdisk.sh
More file actions
executable file
·64 lines (52 loc) · 1.15 KB
/
cremdisk.sh
File metadata and controls
executable file
·64 lines (52 loc) · 1.15 KB
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
#! /bin/bash
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
export LD_LIBRARY_PATH
PRGDIR=/home/pi/work/automail
RAMDIR=/mnt/ramdisk
RECV_BIN=$RAMDIR/recv-bin
SEND_BIN=$RAMDIR/send-bin
RAMDIRNAME=dbf
create() {
echo $"Checking ramdisk... "
mount -l|grep $RAMDIRNAME
RETVAL=$?
echo $RETVAL
echo
if [ $RETVAL -ne 0 ] ; then
echo $"Mounting ramdisk... "
mkdir -p $RAMDIR
mount -t tmpfs -o size=100M $RAMDIRNAME $RAMDIR
mkdir -p $RECV_BIN $SEND_BIN
chmod 777 $RECV_BIN $SEND_BIN
#rm $PRGDIR/recv-bin
#rm $PRGDIR/send-bin
#ln -s $RECV_BIN $PRGDIR/recv-bin
#ln -s $SEND_BIN $PRGDIR/send-bin
RETVAL=$?
echo $RETVAL
echo
fi
ulimit -n 102400
return $RETVAL
}
delete() {
echo $"Deleting ramdisk... "
mount -l|grep $RAMDIRNAME
RETVAL=$?
echo $RETVAL
echo
if [ $RETVAL -ne 1 ] ; then
umount -v $RAMDIR
fi
}
case "$1" in
mount)
create
;;
umount)
delete
;;
*)
echo $"Usage: $0 {mount|umount}"
exit 1
esac