2016-07-20 22:49:44 +02:00
|
|
|
|
2016-07-21 17:50:11 +02:00
|
|
|
Import-Module $PSScriptRoot/CronTab/CronTab.psd1
|
2016-07-13 01:00:13 +02:00
|
|
|
|
|
|
|
# Get the existing cron jobs
|
2016-07-20 22:49:44 +02:00
|
|
|
Get-CronJob
|
2016-07-13 01:00:13 +02:00
|
|
|
|
2016-07-20 22:49:44 +02:00
|
|
|
# New cron job to clean out tmp every day at 1am
|
|
|
|
New-CronJob -Command 'rm -rf /tmp/*' -Hour 1
|
2016-07-13 01:00:13 +02:00
|
|
|
|
2016-07-20 22:49:44 +02:00
|
|
|
# New cron job to start a build
|
|
|
|
New-CronJob -Command 'powershell -c "cd ~/src/PowerShell; ipmo ./build.psm1; Start-PSBuild"' -Hour 2 -DayOfWeek 1-5
|
|
|
|
|
|
|
|
# Sort them by data
|
|
|
|
Get-CronJob | Sort-Object Command
|
2016-07-13 01:00:13 +02:00
|
|
|
|
|
|
|
# Show in bash that the new cron job exists
|
2016-07-20 22:49:44 +02:00
|
|
|
crontab -l
|
|
|
|
|
|
|
|
# Remove a cron job
|
|
|
|
Get-CronJob | Where-Object { $_.Command -match '^powershell.*' } | Remove-CronJob
|
|
|
|
|