4 ms·
I've actually tried script and expect, but they didn't work. I had enabled the debug option on expect and I couldn't see the password prompt when the program r
by brewedDoritos 3y ago
I've actually tried script and expect, but they didn't work.
I had enabled the debug option on expect and I couldn't see the password prompt when the program ran under cron (i was redirecting the script output to a log file). It did appear when running on the prompt though.
I couldn't figure how the sftp program was determining that it was running under cron. I suspect that it was inspecting if stdin was connected to a terminal or not, but I gave up around 4 am.
- MobiusHorizons 3y agoStrace is your friend in such circumstances.
- noAnswer 3y agoThe other month I had to wrap a commercial server program with 'screen'. 'script' wasn't enough. If you would run it in the background "./program &" and then exited ssh it would also exit. It wouldn't run with cron until: export TERM=vt100 script -c "screen /foo/bar/program" /dev/null All the program did on the console was print to stdout. How are you even program shit like this!?
- brewedDoritos 3y ago> If you would run it in the background "./program &" and then exited ssh it would also exit. Just wondering... have you tried running it with nohup and in the background?
- noAnswer 3y agoNo, I haven't tried that.
- oasisaimlessly 3y agoIt was probably checking for a 'controlling terminal' by e.g. opening /dev/tty.
- fulafel 3y agoScript and expect provide the program a controlling terminal, using the same pty functionality that tmux and X11/Wayland terminal emulators use.