Skip to content

Commit 2c6d551

Browse files
romellemphated
authored andcommitted
Docs: Recipe for running gulp via cron task (gulpjs#2034)
1 parent c4d219e commit 2c6d551

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/recipes/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@
2626
* [Run Grunt Tasks from Gulp](run-grunt-tasks-from-gulp.md)
2727
* [Exports as tasks](exports-as-tasks.md)
2828
* [Rollup with rollup-stream](rollup-with-rollup-stream.md)
29+
* [Run gulp task via cron job](cron-task.md)

docs/recipes/cron-task.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Run gulp task via cron job
2+
3+
While logged in via a user that has privileges to run `gulp`, run the following:
4+
5+
crontab -e
6+
7+
to edit your current "[crontab](https://en.wikipedia.org/wiki/Cron)" file.
8+
9+
Typically, within a cron job, you want to run any binary using absolute paths,
10+
so an initial approach to running `gulp build` every minute might look like:
11+
12+
* * * * * cd /your/dir/to/run/in && /usr/local/bin/gulp build
13+
14+
However, you might see in the cron logs that you get this error:
15+
16+
> `/usr/bin/env: node: No such file or directory`
17+
18+
To fix this, we need to add a [symbolic link](https://en.wikipedia.org/wiki/Ln_\(Unix\))
19+
within `/usr/bin` to point to the actual path of our node binary.
20+
21+
Be sure you are logged in as a **sudo** user, and paste in the following command to your terminal:
22+
23+
sudo ln -s $(which node) /usr/bin/node
24+
25+
Once this link is established, your cron task should run successfully.

0 commit comments

Comments
 (0)