crontab: error unable to invoke subcommand
dmoroz0v opened this issue · comments
- create
run.sh
with content:
#!/bin/bash
./test.swift asdf.json
and create test.swift
with content
#!/usr/bin/swift sh
print("test", CommandLine.arguments)
-
exec
crontab -e
-
insert
*/1 * * * * cd ~/Projects/my-project-name && ./run.sh
-
exec
less /var/mail/my_user_name
See error:
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-sh (No such file or directory)
If I run ./run.sh
then I have printed:
test ["/Users/my_user_name/Library/Developer/swift-sh.cache/test/.build/debug/test", "asdf.json"]
I fixed it.
Change run.sh
content with:
#!/bin/bash
/usr/local/bin/swift-sh ./test.swift asdf.json
cron executes without /usr/local/bin in the PATH
, so yeah, obviously this would be the result.