@@ -9,7 +9,7 @@ LOG_DIR="/var/log/vilesql"
9
9
LOG_FILE=" $LOG_DIR /vilesql.log"
10
10
BIN_PATH=" /usr/bin/vilesql"
11
11
SERVICE_PATH=" /etc/systemd/system/vilesql.service"
12
- ENV_FILE=" /var/lib /vilesql/.env"
12
+ ENV_FILE=" /etc /vilesql/.env"
13
13
USER=" vilesql"
14
14
GROUP=" vilesql"
15
15
@@ -36,6 +36,11 @@ if ! id "$USER" &>/dev/null; then
36
36
}
37
37
fi
38
38
39
+ # Ensure correct ownership for binary
40
+ log " 🔧 Fixing ownership for VileSQL binary"
41
+ chown " $USER :$GROUP " " $BIN_PATH "
42
+ chmod 755 " $BIN_PATH "
43
+
39
44
# Create necessary directories with correct ownership
40
45
for dir in " $DATA_DIR " " $CONFIG_DIR " " $LOG_DIR " ; do
41
46
if [[ ! -d " $dir " ]]; then
@@ -62,7 +67,7 @@ if [[ ! -f "$ENV_FILE" ]]; then
62
67
echo " HOST=0.0.0.0" | sudo tee " $ENV_FILE "
63
68
fi
64
69
65
- # Fix permissions to allow VileSQL access
70
+ # Fix permissions for environment file
66
71
log " 🔧 Setting correct permissions for environment file"
67
72
chown " $USER :$GROUP " " $ENV_FILE "
68
73
chmod 600 " $ENV_FILE "
@@ -71,13 +76,6 @@ chmod 600 "$ENV_FILE"
71
76
chmod 755 " $DATA_DIR "
72
77
chmod 700 " $CONFIG_DIR "
73
78
chmod 755 " $LOG_DIR "
74
- chmod 644 " $LOG_FILE "
75
-
76
- # Ensure binary exists
77
- if [[ ! -x " $BIN_PATH " ]]; then
78
- log " ❌ VileSQL binary not found at $BIN_PATH "
79
- exit 1
80
- fi
81
79
82
80
# Install systemd service file (if missing)
83
81
if [[ ! -f " $SERVICE_PATH " ]]; then
@@ -103,22 +101,17 @@ if ldd "$BIN_PATH" | grep -q "not found"; then
103
101
exit 1
104
102
fi
105
103
106
- # Prompt user to start service immediately
107
- read -p " ▶️ Start VileSQL now? (y/n): " choice
108
- if [[ " $choice " == " y" ]]; then
109
- systemctl start vilesql || {
110
- log " ❌ Failed to start VileSQL service."
111
- exit 1
112
- }
113
- log " ✅ VileSQL service started!"
114
-
115
- # Check if service stays running
116
- sleep 2
117
- if ! systemctl is-active --quiet vilesql; then
118
- log " ❌ VileSQL stopped unexpectedly! Run: journalctl -u vilesql --no-pager | tail -n 20"
119
- fi
120
- else
121
- log " ⚠️ You can start it manually using: sudo systemctl start vilesql"
104
+ # Start the service
105
+ log " ▶️ Starting VileSQL service as user: $USER "
106
+ systemctl start vilesql || {
107
+ log " ❌ Failed to start VileSQL service."
108
+ exit 1
109
+ }
110
+
111
+ # Check if service stays running
112
+ sleep 2
113
+ if ! systemctl is-active --quiet vilesql; then
114
+ log " ❌ VileSQL stopped unexpectedly! Run: journalctl -u vilesql --no-pager | tail -n 20"
122
115
fi
123
116
124
117
log " ✅ VileSQL installation completed successfully!"
@@ -132,5 +125,5 @@ echo "🚀 Next steps:"
132
125
echo " 1️⃣ Edit config: sudo nano $ENV_FILE "
133
126
echo " 2️⃣ Check status: sudo systemctl status vilesql"
134
127
echo " 3️⃣ View logs: sudo tail -f $LOG_FILE "
135
- echo " 4️⃣ Run manually: vilesql --help"
128
+ echo " 4️⃣ Run manually: sudo -u vilesql /usr/bin/ vilesql --help"
136
129
echo " "
0 commit comments