const { execCommand } = require('./ssh_service');
require('dotenv').config();

(async () => {
    try {
        console.log('--- Diagnosing Service Name ---');
        console.log('Checking systemctl unit files...');
        try {
            const list = await execCommand('systemctl list-units --type=service --all | grep bacula');
            console.log(list);
        } catch (e) { console.log('systemctl check failed or no grep match'); }

        console.log('\nChecking /etc/init.d...');
        try {
            const list2 = await execCommand('ls /etc/init.d | grep bacula');
            console.log(list2);
        } catch (e) { console.log('init.d check failed'); }

    } catch (err) {
        console.error('Diagnostic error:', err);
    }
})();
