Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Hi guys I want to set up a cronjob on reboot to do this

cd /home/admin/vivalaminecraft.com && screen -d -m -S mcscreen && mono McMyAdmin.exe

The issue is when I execute this it seems to create the screen but doesn't do the mono McMyAdmin.exe in the screen...

Is there like a then command ?

so it does 1. then 2. then 3. ?

Could someone please help out :)

So I tried this:

so I did this:

@reboot screen -dmS minecraft
@reboot cd /home/admin/vivalaminecraft.com
@reboot mono McMyAdmin.exe

It still doesn't work. The screen is created but it doesn't have the mono execution in it

I put this in it

#!/bin/bash

screen -dmS minecraft;
cd /home/admin/vivalaminecraft.com;
mono McMyAdmin.exe;

is this correct?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Put the following into your crontab file

@reboot screen -d -m -S mcscreen 
@reboot mono /home/admin/vivalaminecraft.com/McMyAdmin.exe

Crontabs run through in order from top to bottom, so if things have the exact same time or parameter the top one will run first.

I don't know if mcscreen is a file inside vivilaminecraft.com but if it is then include the absolute path.

If that doesn't work you could try adding a shell script into /etc/init.d/ to run those commands, items in init.d get called during boot up.

share|improve this answer
    
That works if I do it manually but not as a cronjob =/ Still doesn't work. The screen gets created. If I do it manually it works perfectly...but for some reason this just doesn't want to work –  Josip Gòdly Zirdum Nov 28 '11 at 0:02
    
I have edited my answer with something else to try. –  Toby Nov 28 '11 at 0:05
    
So I tried to do that, but i'm a bit of a noob. I made a file just named it mserver and I put this code in it(look at main question, can't format here) That didn't work. –  Josip Gòdly Zirdum Nov 28 '11 at 0:47
    
May have just noticed the problem, will test now...(it didn't have execute privileges) –  Josip Gòdly Zirdum Nov 28 '11 at 0:50
    
It still doesn't work. –  Josip Gòdly Zirdum Nov 28 '11 at 0:54

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.