-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
To create a "keep alive" command that runs every 15 minutes and prevents a GitHub Codespace from going to sleep, you can use a combination of a shell script and a cron job. The shell script will execute a command that does nothing (e.g., echo "keep alive"), and the cron job will schedule this script to run every 15 minutes. | ||
# By following these steps, you can create a "keep alive" command that runs every 15 minutes and prevents your GitHub Codespace from going to sleep. | ||
|
||
Step-by-Step Plan | ||
Create a Shell Script: Create a shell script that executes a command to keep the Codespace alive. | ||
Set Up a Cron Job: Set up a cron job to run the shell script every 15 minutes. | ||
Step 1: Create a Shell Script | ||
Create a shell script named keep_alive.sh in your GitHub Codespace. | ||
You can use a combination of a shell script and a cron job. The shell script will execute a command that does nothing (e.g., echo "keep alive"), and the cron job will schedule this script to run every 15 minutes. | ||
|
||
> Pending task: Find out the right nothingness command to keep the terminal session active | ||
# Step-by-Step Plan | ||
|
||
- Create a Shell Script: Create a shell script that executes a command to keep the Codespace alive. | ||
- Set Up a Cron Job: Set up a cron job to run the shell script every 15 minutes. | ||
|
||
## Step 1: Create a shell script named keep_alive.sh in your GitHub Codespace. | ||
|
||
`keep_alive.sh` | ||
|
||
keep_alive.sh | ||
Make the script executable: | ||
|
||
Step 2: Set Up a Cron Job | ||
Set up a cron job to run the keep_alive.sh script every 15 minutes. | ||
`chmod +x keep_alive.sh` | ||
|
||
## Step 2: Set up a cron job to run the keep_alive.sh script every 15 minutes. | ||
|
||
Open the Crontab Editor: Open the crontab editor by running the following command: | ||
Add the Cron Job: Add the following line to the crontab file to schedule the keep_alive.sh script to run every 15 minutes. Replace /path/to/keep_alive.sh with the actual path to your script. | ||
Save and exit the crontab editor. | ||
1. Open the Crontab Editor: Open the crontab editor by running the following command: | ||
2. Add the Cron Job: Add the following line to the crontab file to schedule the keep_alive.sh script to run every 15 minutes. Replace /path/to/keep_alive.sh with the actual path to your script. | ||
3. Save and exit the crontab editor. | ||
|
||
Explanation | ||
Shell Script: The keep_alive.sh script contains a simple command (echo "keep alive") that does nothing but keeps the terminal session active. | ||
Cron Job: The cron job is set to run the keep_alive.sh script every 15 minutes (*/15 * * * *). | ||
Example | ||
If your keep_alive.sh script is located in the /home/codespace directory, the cron job entry would look like this: | ||
> Explanation: Shell Script: The keep*alive.sh script contains a simple command (echo "keep alive") that does nothing but keeps the terminal session active. Cron Job: The cron job is set to run the keep_alive.sh script every 15 minutes (*/15 \_ \* \* \*). | ||
By following these steps, you can create a "keep alive" command that runs every 15 minutes and prevents your GitHub Codespace from going to sleep. | ||
> Example: If your keep_alive.sh script is located in the /home/codespace directory, the cron job entry would look like this: |