Skip to content

Commit 80faa92

Browse files
committed
Add cli cmd for reading services config files
1 parent 1287817 commit 80faa92

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

bin/v-open-fs-config

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 file on fs
16+
if [ ! -e "$src_file" ]; then
17+
echo "Error: $src_file file doesn't exist"
18+
exit 3
19+
fi
20+
21+
# Checking path
22+
if [ ! -z "$src_file" ]; then
23+
rpath=$(readlink -f "$src_file")
24+
services="nginx|apache|httpd|php|ftp|bind|named|exim|dovecot|spamassassin"
25+
services="$services|clam|mysql|postgresql|pgsql|cron|ssh|fail2ban|iptables"
26+
services="$services|my.cnf"
27+
spath=$(echo "$rpath" |egrep "$services")
28+
if [ -z "$spath" ]; then
29+
echo "Error: invalid source path $src_file"
30+
exit 2
31+
fi
32+
spath=$(echo "$rpath" |egrep "/etc|/var/lib")
33+
if [ -z "$spath" ]; then
34+
echo "Error: invalid source path $src_file"
35+
exit 2
36+
fi
37+
fi
38+
39+
# Reading conf
40+
cat "$src_file" 2>/dev/null
41+
if [ $? -ne 0 ]; then
42+
echo "Error: file $src_file was not opened"
43+
exit 3
44+
fi
45+
46+
# Exiting
47+
exit

install/upgrade/versions/latest.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ mv $HESTIA/bin/v-get-fs-file-type $HESTIA_BACKUP/bin/
8686
mv $HESTIA/bin/v-list-fs-directory $HESTIA_BACKUP/bin/
8787
mv $HESTIA/bin/v-move-fs-directory $HESTIA_BACKUP/bin/
8888
mv $HESTIA/bin/v-move-fs-file $HESTIA_BACKUP/bin/
89-
mv $HESTIA/bin/v-open-fs-config $HESTIA_BACKUP/bin/
9089
mv $HESTIA/bin/v-open-fs-file $HESTIA_BACKUP/bin/
9190
mv $HESTIA/bin/v-search-fs-object $HESTIA_BACKUP/bin/
9291
if [ ! -d "$HESTIA_BACKUP/web" ]; then

0 commit comments

Comments
 (0)