What exactly is non-interactive program?

man page for wget says

NAME Wget - The non-interactive network downloader.
DESCRIPTION Wget is non-interactive, meaning that it can work in the background, while the user is not logged on. This allows you to start a retrieval and disconnect from the system, letting Wget finish the work. By contrast, most of the Web browsers require constant user's presence, which can be a great hindrance when transferring a lot of data.

wget is an example of non-interactive program I know. Now my question is,

  • How can wget be used without user logged on?
  • How does non-interactive programs work?
4

2 Answers

How can wget be used without user logged on?

By including the wget command in a daemon/service or a program where you as a user do no initiate the download.

How does non-interactive programs work?

When you create a deamon and have this daemon active it can continue to probe a server and ask for a download. If the servers is dead the non-interactive program will continue when the server is back up without any need for the user to act.

Updating Ubuntu, for instance, can be done without any action from a user and even without logging in.

For me the easiest way of running things while you are not logged in is by including a line in your crontab file:

# m h dom mon dow command
*/30 * * * * test -x /home/koju/bin/yourscript && /home/koju/bin/yourscript

The test is there to not to have cron complain via email when yourscript cannot be found. For the format of the first fields look at man 5 crontab.

From yourscript you call wget, since it is non-interactive it will not prompt you to interact by asking for input. As long as the command line options of wget get you the information you need, the above set up will run for you every 30 minutes.

Of course you should test yourscript by starting it by hand, before committing it to run on a regular basis. You might find that wget is not powerful enough to do what you want, especially on web pages that require user-interaction above the basic login.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like