Beginner Linux user! Having trouble with cron

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












I have an Intel NUC with Ubuntu installed. It runs a Minecraft server.
I wanted a simple backup system for the server, and through some Googling I found that I can do so using cron and tar.
However, I seem to be unable to make cron do anything at all.



I made a simple test script for cron to run.



#!/bin/bash
cd ~/minecraft/Backups
touch bla.txt



And I modified my crontab by adding this.



# m h dom mon dow command
10 16 * * * /home/ben/minecraft/Backups/Test.sh



I waited for 16:10 to come and... nothing happened. There was no bla.txt file created. I tried it numerous times by entering different times and still nothing.



The script works when I run it manually. Any idea what I'm missing?







share|improve this question


















  • 2




    Please don't post screenshots of text. Instead copy-paste or transcribe the text. Text within images cannot be read by screenreaders (which visually-impaired users might use) nor will Google or other search engines process text within images.
    – jayhendren
    Jan 5 at 21:30






  • 1




    Is the cron daemon enabled and running? How did you edit your crontab (with crontab -e or some other method)?
    – jayhendren
    Jan 5 at 21:31






  • 1




    Does your script have execute permissions (i.e. what does ls -l /home/ben/minecraft/Backups/Test.sh say)?
    – jayhendren
    Jan 5 at 21:32










  • @jayhendren Oh, I didn't realize that screenshots could be problematic. I'll change it shortly. When I run the command you suggested I get: -rwxr-xr-x 1 root root 51 Jan 5 11:37 /home/ben/minecraft/Backups/Test.sh
    – user269086
    Jan 5 at 21:37















up vote
1
down vote

favorite
1












I have an Intel NUC with Ubuntu installed. It runs a Minecraft server.
I wanted a simple backup system for the server, and through some Googling I found that I can do so using cron and tar.
However, I seem to be unable to make cron do anything at all.



I made a simple test script for cron to run.



#!/bin/bash
cd ~/minecraft/Backups
touch bla.txt



And I modified my crontab by adding this.



# m h dom mon dow command
10 16 * * * /home/ben/minecraft/Backups/Test.sh



I waited for 16:10 to come and... nothing happened. There was no bla.txt file created. I tried it numerous times by entering different times and still nothing.



The script works when I run it manually. Any idea what I'm missing?







share|improve this question


















  • 2




    Please don't post screenshots of text. Instead copy-paste or transcribe the text. Text within images cannot be read by screenreaders (which visually-impaired users might use) nor will Google or other search engines process text within images.
    – jayhendren
    Jan 5 at 21:30






  • 1




    Is the cron daemon enabled and running? How did you edit your crontab (with crontab -e or some other method)?
    – jayhendren
    Jan 5 at 21:31






  • 1




    Does your script have execute permissions (i.e. what does ls -l /home/ben/minecraft/Backups/Test.sh say)?
    – jayhendren
    Jan 5 at 21:32










  • @jayhendren Oh, I didn't realize that screenshots could be problematic. I'll change it shortly. When I run the command you suggested I get: -rwxr-xr-x 1 root root 51 Jan 5 11:37 /home/ben/minecraft/Backups/Test.sh
    – user269086
    Jan 5 at 21:37













up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I have an Intel NUC with Ubuntu installed. It runs a Minecraft server.
I wanted a simple backup system for the server, and through some Googling I found that I can do so using cron and tar.
However, I seem to be unable to make cron do anything at all.



I made a simple test script for cron to run.



#!/bin/bash
cd ~/minecraft/Backups
touch bla.txt



And I modified my crontab by adding this.



# m h dom mon dow command
10 16 * * * /home/ben/minecraft/Backups/Test.sh



I waited for 16:10 to come and... nothing happened. There was no bla.txt file created. I tried it numerous times by entering different times and still nothing.



The script works when I run it manually. Any idea what I'm missing?







share|improve this question














I have an Intel NUC with Ubuntu installed. It runs a Minecraft server.
I wanted a simple backup system for the server, and through some Googling I found that I can do so using cron and tar.
However, I seem to be unable to make cron do anything at all.



I made a simple test script for cron to run.



#!/bin/bash
cd ~/minecraft/Backups
touch bla.txt



And I modified my crontab by adding this.



# m h dom mon dow command
10 16 * * * /home/ben/minecraft/Backups/Test.sh



I waited for 16:10 to come and... nothing happened. There was no bla.txt file created. I tried it numerous times by entering different times and still nothing.



The script works when I run it manually. Any idea what I'm missing?









share|improve this question













share|improve this question




share|improve this question








edited Jan 5 at 21:41

























asked Jan 5 at 21:21









user269086

84




84







  • 2




    Please don't post screenshots of text. Instead copy-paste or transcribe the text. Text within images cannot be read by screenreaders (which visually-impaired users might use) nor will Google or other search engines process text within images.
    – jayhendren
    Jan 5 at 21:30






  • 1




    Is the cron daemon enabled and running? How did you edit your crontab (with crontab -e or some other method)?
    – jayhendren
    Jan 5 at 21:31






  • 1




    Does your script have execute permissions (i.e. what does ls -l /home/ben/minecraft/Backups/Test.sh say)?
    – jayhendren
    Jan 5 at 21:32










  • @jayhendren Oh, I didn't realize that screenshots could be problematic. I'll change it shortly. When I run the command you suggested I get: -rwxr-xr-x 1 root root 51 Jan 5 11:37 /home/ben/minecraft/Backups/Test.sh
    – user269086
    Jan 5 at 21:37













  • 2




    Please don't post screenshots of text. Instead copy-paste or transcribe the text. Text within images cannot be read by screenreaders (which visually-impaired users might use) nor will Google or other search engines process text within images.
    – jayhendren
    Jan 5 at 21:30






  • 1




    Is the cron daemon enabled and running? How did you edit your crontab (with crontab -e or some other method)?
    – jayhendren
    Jan 5 at 21:31






  • 1




    Does your script have execute permissions (i.e. what does ls -l /home/ben/minecraft/Backups/Test.sh say)?
    – jayhendren
    Jan 5 at 21:32










  • @jayhendren Oh, I didn't realize that screenshots could be problematic. I'll change it shortly. When I run the command you suggested I get: -rwxr-xr-x 1 root root 51 Jan 5 11:37 /home/ben/minecraft/Backups/Test.sh
    – user269086
    Jan 5 at 21:37








2




2




Please don't post screenshots of text. Instead copy-paste or transcribe the text. Text within images cannot be read by screenreaders (which visually-impaired users might use) nor will Google or other search engines process text within images.
– jayhendren
Jan 5 at 21:30




Please don't post screenshots of text. Instead copy-paste or transcribe the text. Text within images cannot be read by screenreaders (which visually-impaired users might use) nor will Google or other search engines process text within images.
– jayhendren
Jan 5 at 21:30




1




1




Is the cron daemon enabled and running? How did you edit your crontab (with crontab -e or some other method)?
– jayhendren
Jan 5 at 21:31




Is the cron daemon enabled and running? How did you edit your crontab (with crontab -e or some other method)?
– jayhendren
Jan 5 at 21:31




1




1




Does your script have execute permissions (i.e. what does ls -l /home/ben/minecraft/Backups/Test.sh say)?
– jayhendren
Jan 5 at 21:32




Does your script have execute permissions (i.e. what does ls -l /home/ben/minecraft/Backups/Test.sh say)?
– jayhendren
Jan 5 at 21:32












@jayhendren Oh, I didn't realize that screenshots could be problematic. I'll change it shortly. When I run the command you suggested I get: -rwxr-xr-x 1 root root 51 Jan 5 11:37 /home/ben/minecraft/Backups/Test.sh
– user269086
Jan 5 at 21:37





@jayhendren Oh, I didn't realize that screenshots could be problematic. I'll change it shortly. When I run the command you suggested I get: -rwxr-xr-x 1 root root 51 Jan 5 11:37 /home/ben/minecraft/Backups/Test.sh
– user269086
Jan 5 at 21:37











1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










I am not sure if this answers your question, but I would suggest you to replace this line:



cd ~/minecraft/Backups


With this:



cd /home/ben/minecraft/Backups


Make sure your script has execution permissions:



chmod +x /home/ben/minecraft/Backups/Test.sh


Check if cron is installed and running:



/etc/init.d/cron status


If not, install it / start it:



apt-get install cron
/etc/init.d/cron start





share|improve this answer
















  • 1




    Oh my! It... it works! Thank you so much! I had no idea that the change directory thing could be finicky like that.
    – user269086
    Jan 5 at 22:02











  • Ohhhh. It seems I was making executable the scripts the wrong way... It's necessary to specify the whole path?
    – user269086
    Jan 5 at 22:13











  • @user269086 it is not necessary. I used the whole path, since I don't know which is your pwd ... relative paths are ok as well : )
    – ncomputers
    Jan 5 at 22:20











  • Weird. Just now I made executable the backup script again. (My original goal) But this time I specified the entire path. And cron ran the script this time. Well, whatever works.
    – user269086
    Jan 5 at 23:12










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f415088%2fbeginner-linux-user-having-trouble-with-cron%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










I am not sure if this answers your question, but I would suggest you to replace this line:



cd ~/minecraft/Backups


With this:



cd /home/ben/minecraft/Backups


Make sure your script has execution permissions:



chmod +x /home/ben/minecraft/Backups/Test.sh


Check if cron is installed and running:



/etc/init.d/cron status


If not, install it / start it:



apt-get install cron
/etc/init.d/cron start





share|improve this answer
















  • 1




    Oh my! It... it works! Thank you so much! I had no idea that the change directory thing could be finicky like that.
    – user269086
    Jan 5 at 22:02











  • Ohhhh. It seems I was making executable the scripts the wrong way... It's necessary to specify the whole path?
    – user269086
    Jan 5 at 22:13











  • @user269086 it is not necessary. I used the whole path, since I don't know which is your pwd ... relative paths are ok as well : )
    – ncomputers
    Jan 5 at 22:20











  • Weird. Just now I made executable the backup script again. (My original goal) But this time I specified the entire path. And cron ran the script this time. Well, whatever works.
    – user269086
    Jan 5 at 23:12














up vote
2
down vote



accepted










I am not sure if this answers your question, but I would suggest you to replace this line:



cd ~/minecraft/Backups


With this:



cd /home/ben/minecraft/Backups


Make sure your script has execution permissions:



chmod +x /home/ben/minecraft/Backups/Test.sh


Check if cron is installed and running:



/etc/init.d/cron status


If not, install it / start it:



apt-get install cron
/etc/init.d/cron start





share|improve this answer
















  • 1




    Oh my! It... it works! Thank you so much! I had no idea that the change directory thing could be finicky like that.
    – user269086
    Jan 5 at 22:02











  • Ohhhh. It seems I was making executable the scripts the wrong way... It's necessary to specify the whole path?
    – user269086
    Jan 5 at 22:13











  • @user269086 it is not necessary. I used the whole path, since I don't know which is your pwd ... relative paths are ok as well : )
    – ncomputers
    Jan 5 at 22:20











  • Weird. Just now I made executable the backup script again. (My original goal) But this time I specified the entire path. And cron ran the script this time. Well, whatever works.
    – user269086
    Jan 5 at 23:12












up vote
2
down vote



accepted







up vote
2
down vote



accepted






I am not sure if this answers your question, but I would suggest you to replace this line:



cd ~/minecraft/Backups


With this:



cd /home/ben/minecraft/Backups


Make sure your script has execution permissions:



chmod +x /home/ben/minecraft/Backups/Test.sh


Check if cron is installed and running:



/etc/init.d/cron status


If not, install it / start it:



apt-get install cron
/etc/init.d/cron start





share|improve this answer












I am not sure if this answers your question, but I would suggest you to replace this line:



cd ~/minecraft/Backups


With this:



cd /home/ben/minecraft/Backups


Make sure your script has execution permissions:



chmod +x /home/ben/minecraft/Backups/Test.sh


Check if cron is installed and running:



/etc/init.d/cron status


If not, install it / start it:



apt-get install cron
/etc/init.d/cron start






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 5 at 21:48









ncomputers

8381418




8381418







  • 1




    Oh my! It... it works! Thank you so much! I had no idea that the change directory thing could be finicky like that.
    – user269086
    Jan 5 at 22:02











  • Ohhhh. It seems I was making executable the scripts the wrong way... It's necessary to specify the whole path?
    – user269086
    Jan 5 at 22:13











  • @user269086 it is not necessary. I used the whole path, since I don't know which is your pwd ... relative paths are ok as well : )
    – ncomputers
    Jan 5 at 22:20











  • Weird. Just now I made executable the backup script again. (My original goal) But this time I specified the entire path. And cron ran the script this time. Well, whatever works.
    – user269086
    Jan 5 at 23:12












  • 1




    Oh my! It... it works! Thank you so much! I had no idea that the change directory thing could be finicky like that.
    – user269086
    Jan 5 at 22:02











  • Ohhhh. It seems I was making executable the scripts the wrong way... It's necessary to specify the whole path?
    – user269086
    Jan 5 at 22:13











  • @user269086 it is not necessary. I used the whole path, since I don't know which is your pwd ... relative paths are ok as well : )
    – ncomputers
    Jan 5 at 22:20











  • Weird. Just now I made executable the backup script again. (My original goal) But this time I specified the entire path. And cron ran the script this time. Well, whatever works.
    – user269086
    Jan 5 at 23:12







1




1




Oh my! It... it works! Thank you so much! I had no idea that the change directory thing could be finicky like that.
– user269086
Jan 5 at 22:02





Oh my! It... it works! Thank you so much! I had no idea that the change directory thing could be finicky like that.
– user269086
Jan 5 at 22:02













Ohhhh. It seems I was making executable the scripts the wrong way... It's necessary to specify the whole path?
– user269086
Jan 5 at 22:13





Ohhhh. It seems I was making executable the scripts the wrong way... It's necessary to specify the whole path?
– user269086
Jan 5 at 22:13













@user269086 it is not necessary. I used the whole path, since I don't know which is your pwd ... relative paths are ok as well : )
– ncomputers
Jan 5 at 22:20





@user269086 it is not necessary. I used the whole path, since I don't know which is your pwd ... relative paths are ok as well : )
– ncomputers
Jan 5 at 22:20













Weird. Just now I made executable the backup script again. (My original goal) But this time I specified the entire path. And cron ran the script this time. Well, whatever works.
– user269086
Jan 5 at 23:12




Weird. Just now I made executable the backup script again. (My original goal) But this time I specified the entire path. And cron ran the script this time. Well, whatever works.
– user269086
Jan 5 at 23:12












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f415088%2fbeginner-linux-user-having-trouble-with-cron%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)