Files
oculog/clients/ubuntu/troubleshoot-install.sh
2026-02-12 14:52:37 -06:00

88 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Troubleshooting script for Oculog client installation
echo "Checking Oculog client installation..."
echo ""
# Check if client script exists
if [ -f /opt/oculog/client.py ]; then
echo "✓ Client script found at /opt/oculog/client.py"
else
echo "✗ Client script NOT found at /opt/oculog/client.py"
echo " You may need to download it manually or re-run the installer"
fi
# Check if config exists
if [ -f /etc/oculog/client.conf ]; then
echo "✓ Configuration file found at /etc/oculog/client.conf"
echo " Current config:"
cat /etc/oculog/client.conf | sed 's/^/ /'
else
echo "✗ Configuration file NOT found at /etc/oculog/client.conf"
fi
# Check if service file exists
if [ -f /etc/systemd/system/oculog-client.service ]; then
echo "✓ Systemd service file found"
echo " Service file contents:"
cat /etc/systemd/system/oculog-client.service | sed 's/^/ /'
else
echo "✗ Systemd service file NOT found"
echo ""
echo "Creating systemd service file..."
# Determine Python path
if [ -f /opt/oculog/venv/bin/python3 ]; then
PYTHON_BIN="/opt/oculog/venv/bin/python3"
echo " Using virtual environment Python: $PYTHON_BIN"
else
PYTHON_BIN="/usr/bin/python3"
echo " Using system Python: $PYTHON_BIN"
fi
# Create service file
cat > /etc/systemd/system/oculog-client.service << EOF
[Unit]
Description=Oculog Client Agent
After=network.target
[Service]
Type=simple
User=root
ExecStart=${PYTHON_BIN} /opt/oculog/client.py
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
echo "✓ Service file created"
systemctl daemon-reload
echo "✓ Systemd daemon reloaded"
fi
# Check if symlink exists
if [ -L /usr/local/bin/oculog-client ]; then
echo "✓ Symlink found at /usr/local/bin/oculog-client"
else
echo "✗ Symlink NOT found"
if [ -f /opt/oculog/client.py ]; then
echo " Creating symlink..."
ln -sf /opt/oculog/client.py /usr/local/bin/oculog-client
echo "✓ Symlink created"
fi
fi
echo ""
echo "Installation check complete!"
echo ""
echo "To start the service:"
echo " sudo systemctl start oculog-client"
echo " sudo systemctl enable oculog-client"
echo ""
echo "To check status:"
echo " sudo systemctl status oculog-client"