Hello I have the following code to reboot a device
connection.on('connect', async function () {
await connection.send('', async function (err, res) {
if (err) return err
console.log('resp after cmd 1:', res.trim())
await connection.send('reboot', async function (err, res) {
if (err) return err
if (res.indexOf('Save config to flash ') > -1) {
console.log('resp after cmd 2:', res)
await connection.send('n', async function (err, res) {
if (err) return err
console.log('resp uptime cmd 3:', res)
await connection.send('y', async function (err, res) {
if (err) return err
console.log('resp uptime cmd 4:', res)
})
})
} else {
await connection.send('y', async function (err, res) {
if (err) return err
console.log('resp uptime cmd 4:', res)
})
}
})
})
});
and these are the outputs I'm getting
10055#
resp after cmd 2: reboot
Save config to flash ROM y/n
resp uptime cmd 3: n
Confirm reboot unit y/n
10055#
resp uptime cmd 4: y
?Unrecognised input
10055#
For some reason after the Confirm reboot unit y/n the process stops and after sending the "y" as response to confirm reboot it is taken as a new command so it returns Unrecognised input.
Thanks for you help
Hello I have the following code to reboot a device
connection.on('connect', async function () {
await connection.send('', async function (err, res) {
if (err) return err
and these are the outputs I'm getting
10055#
resp after cmd 2: reboot
Save config to flash ROM y/n
resp uptime cmd 3: n
Confirm reboot unit y/n
10055#
resp uptime cmd 4: y
?Unrecognised input
10055#
For some reason after the Confirm reboot unit y/n the process stops and after sending the "y" as response to confirm reboot it is taken as a new command so it returns Unrecognised input.
Thanks for you help