Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is my bash script: http://pastebin.com/9kgGYPmt

Ok so simply, when I run the Bash command I get this error: http://puu.sh/6oSTW.png

I really don't know why this is happening. Can anyone help? Thanks :)

This script is designed to restart the machine and will eventually be called via a Cron job, but this is unrelated and really only to allow ServerFault to post this question.

share|improve this question
1  
You're going to restart a server via cron job? No, you don't want to do that. If you think you do, you should find and fix the real problem first. –  Michael Hampton Jan 18 at 5:57
    
I am running 20 Minecraft servers. This is two do two things - 1) Allow updates to the servers 2) Refresh resources. This type of thing isn't uncommon in this use case. Java is one memory hog. –  user3106527 Jan 18 at 7:05
1  
Fine, so kill the java processes, let their memory be reclaimed. Rebooting the server to restart a process is like shooting someone to cure their cold. –  MadHatter Jan 18 at 9:32
    
@MadHatter Well, maybe he just hates his servers. I can think of a few people whom I'd recommend shooting as a cure to a cold. Or a hangnail. Or a mild itch. –  HopelessN00b Jan 19 at 8:48

1 Answer 1

up vote 5 down vote accepted

This is a trivial typo.

You have several lines which include:

`echo -ne '\015'\`

I presume you mean to embed a Ctrl-G bell character into the output.

The error is because you have placed an unnecessary backslash before the final backtick, thus escaping it. This isn't what you want.

Remove it:

`echo -ne '\015'`

Another thing: Get rid of this script entirely.

For starters, you really shouldn't be rebooting your server via a cron job. If you think you want to, you have another problem, which you should actually find and fix. Any reasonable server should be able to remain up and running for more than a day without intervention.

Second, the shutdown command will happily alert all logged on users (and screen sessions!) automatically. If you really must reboot, try using it to schedule your reboot.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.