File tree Expand file tree Collapse file tree 2 files changed +53
-1
lines changed
Expand file tree Collapse file tree 2 files changed +53
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # info: open config
3+ # options: CONFIG
4+ #
5+ # The function opens/reads config files on the file system
6+
7+ src_file=$1
8+
9+ # Checking arguments
10+ if [ -z " $src_file " ]; then
11+ echo " Usage: CONFIG"
12+ exit 1
13+ fi
14+
15+ # Checking hestia user
16+ if [ ! -d " $HESTIA /data/users/$user " ]; then
17+ echo " Error: hestia user $user doesn't exist"
18+ exit 3
19+ fi
20+
21+ # Checking file on fs
22+ if [ ! -e " $src_file " ]; then
23+ echo " Error: $src_file file doesn't exist"
24+ exit 3
25+ fi
26+
27+ # Checking path
28+ if [ ! -z " $src_file " ]; then
29+ rpath=$( readlink -f " $src_file " )
30+ services=" nginx|apache|httpd|php|ftp|bind|named|exim|dovecot|spamassassin"
31+ services=" $services |clam|mysql|postgresql|pgsql|cron|ssh|fail2ban|iptables"
32+ services=" $services |my.cnf"
33+ spath=$( echo " $rpath " | egrep " $services " )
34+ if [ -z " $spath " ]; then
35+ echo " Error: invalid source path $src_file "
36+ exit 2
37+ fi
38+ spath=$( echo " $rpath " | egrep " /etc|/var/lib" )
39+ if [ -z " $spath " ]; then
40+ echo " Error: invalid source path $src_file "
41+ exit 2
42+ fi
43+ fi
44+
45+ # Reading conf
46+ cat " $src_file " 2> /dev/null
47+ if [ $? -ne 0 ]; then
48+ echo " Error: file $src_file was not opened"
49+ exit 3
50+ fi
51+
52+ # Exiting
53+ exit
Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ mv $HESTIA/bin/v-get-fs-file-type $HESTIA_BACKUP/bin/
8686mv $HESTIA /bin/v-list-fs-directory $HESTIA_BACKUP /bin/
8787mv $HESTIA /bin/v-move-fs-directory $HESTIA_BACKUP /bin/
8888mv $HESTIA /bin/v-move-fs-file $HESTIA_BACKUP /bin/
89- mv $HESTIA /bin/v-open-fs-config $HESTIA_BACKUP /bin/
9089mv $HESTIA /bin/v-open-fs-file $HESTIA_BACKUP /bin/
9190mv $HESTIA /bin/v-search-fs-object $HESTIA_BACKUP /bin/
9291if [ ! -d " $HESTIA_BACKUP /web" ]; then
You can’t perform that action at this time.
0 commit comments