Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I run a small PC repair shop with an Ubuntu samba server which shares a plethora of applications for shop use. These include virus removing apps, installers for firefox, OOo and others. Some of these do not receive new versions regularly, but many do.
An increasingly annoying part of my job has become updating these apps as new versions become available. It occurs to me that this could be an automated process. I imagine it would require a shell script and cron job. I have never done anything like this and I was wondering if any of you have advice on how I could accomplish this. If it requires more than 4 hours work, it's not worth it because it takes less than that to manually update the binaries.
Any advice would be greatly appreciated! Thank you all in advance.
The most basic form of shell script is just a text file with the commands you want to run, usually with the first line specifying the command interpreter you want to use. So in its simplest form you can use something like this:
Chmod this file so that root has execute permissions, then simply run "sudo ./scriptname".
You'll probably still want to monitor it manually though, as sometimes packages require manual intervention to avoid problems and conflicts. One of the packages might want to install a new dependency and ask you if you want to continue, or it might decide to terminate if it comes across a conflict for example.
Check the man page of apt-get or aptitude for ways to force it to bypass user intervention, if you really want to do it that way.
On the other hand, I see that there's also a program called cron-apt that will probably let you configure what you want more conveniently.
Last edited by David the H.; 10-06-2009 at 04:20 PM.
The most basic form of shell script is just a text file with the commands you want to run, usually with the first line specifying the command interpreter you want to use. So in its simplest form you can use something like this:
Chmod this file so that root has execute permissions, then simply run "sudo ./scriptname".
You'll probably still want to monitor it manually though, as sometimes packages require manual intervention to avoid problems and conflicts. One of the packages might want to install a new dependency and ask you if you want to continue, or it might decide to terminate if it comes across a conflict for example.
Check the man page of apt-get or aptitude for ways to force it to bypass user intervention, if you really want to do it that way.
On the other hand, I see that there's also a program called cron-apt that will probably let you configure what you want more conveniently.
Excellent, thank you for the information. Would the same thing work for Windows binaries, which is what most of our files are? Just a whole bunch of wget [url to download], then cp [permanent dir]?
For the most part any command that you can run directly in the shell will work the same way inside a script, so yes, you should be able to do that.
But you can also do much more than that if you want to. Unix shells like bash have scripting languages that can almost rival true programming languages in complexity and ability. There are lots of good tutorials out there that can get you started. I personally recommend linuxcommand.org as an easy-to-follow primer on the basics.
For the most part any command that you can run directly in the shell will work the same way inside a script, so yes, you should be able to do that.
But you can also do much more than that if you want to. Unix shells like bash have scripting languages that can almost rival true programming languages in complexity and ability. There are lots of good tutorials out there that can get you started. I personally recommend linuxcommand.org as an easy-to-follow primer on the basics.
Thank you very much. that website seems like just what I need. I will start there. This will be a good way to get a better understanding of bash.
Unix shells like bash have scripting languages that can almost rival true programming languages in complexity and ability.
What do you mean "almost" David ! IMHO, bash script is more complex than C. That's not a Good Thing; C is the more elegant language; bash has accreted so much since the first sh; if we started designing a language with bash's functionality from scratch it would be a lot less complex, at least in its syntax.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.