2017-02-15 2 views
8

ich eine neue Aufgabe in crontab erstellt, wie unten dargestellt:/bin/sh: 1: Syntaxfehler: EOF in Backquote Substitution

*/2 * * * *  mongodump --db prodys --out /backup/databases/mongoDatabases/`date +"%m-%d-%y"` 

ich folgende Störung zu erhalten:

/bin/sh: 1: Syntax error: EOF in backquote substitution 

Bitte Hilfe, ich habe keine Ahnung, was falsch ist.

Antwort

7

Das Problem ist, dass cron% als Zeilenumbrüche behandelt. verwenden Command Substitution Syntax als $() über das Erbe `` Syntax als

Sie Ihren Befehl wie,

Percent-signs (%) in the command, unless escaped with backslash \, will be changed into newline characters, and all data after the first % will be sent to the command as standard input.

Auch

*/2 * * * *  mongodump --db prodys --out /backup/databases/mongoDatabases/$(date +'\%m-\%d-\%y') 
+0

Dank etwas ändern könnte: Von crontab POSIX man Seite! @Inian das war genau mein Problem auch. – ShahNewazKhan

+0

Danke, es hilft sehr! –

Verwandte Themen