{"id":23520092,"url":"https://github.com/ventx/trackbone","last_synced_at":"2025-04-19T18:04:14.665Z","repository":{"id":57169132,"uuid":"104988520","full_name":"ventx/trackbone","owner":"ventx","description":"Automated aws ec2 instance uptime handling with tags","archived":false,"fork":false,"pushed_at":"2017-09-28T07:48:09.000Z","size":394,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-07T05:52:32.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ventx.github.io/trackbone/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ventx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-27T07:48:34.000Z","updated_at":"2018-05-27T14:40:47.000Z","dependencies_parsed_at":"2022-09-13T17:21:11.204Z","dependency_job_id":null,"html_url":"https://github.com/ventx/trackbone","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ventx%2Ftrackbone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ventx%2Ftrackbone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ventx%2Ftrackbone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ventx%2Ftrackbone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ventx","download_url":"https://codeload.github.com/ventx/trackbone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231254785,"owners_count":18348524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-25T16:12:02.090Z","updated_at":"2024-12-25T16:12:02.736Z","avatar_url":"https://github.com/ventx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trackbone\ntrackbone is a nodejs package to parse aws tags and control of AWS EC2 instance uptime.\n\n[![Build Status](https://travis-ci.org/ventx/trackbone.svg?branch=master)](https://travis-ci.org/ventx/trackbone)\n\n```bash\n    # for cli usage (just launch \"trackbone\" in the cli): \n    npm install -g @ventx/trackbone\n    \n    # or just the package for your project:\n    npm install @ventx/trackbone\n```\n\n```javascript\n    const trackbone = require('@ventx/trackbone');\n    let tb = new trackbone();\n    tb.run();\n    \n```\n\n## As an AWS Lambda function\n```bash\n    git clone https://github.com/ventx/trackbone.git\n    cd trackbone\n    npm install\n    zip -r lambda.zip 'lambda.js' './node_modules' './src'\n``` \nNow you can use the created lambda.zip for your lambda function. Use \"lambda.handler\" as the Handler.  \n**Important:** Set the environment variable \"TIMEZONE\" to your timezone. Else trackbone will work with UTC. \n\n## How can i use it?\nThe framework collects the tags of all instances running in an account and searches for the trackbone\ntag (\"trackbone\", \"Trackbone\" or \"TRACKBONE\"). You should include it in your lambda function and trigger it regularly.\nI suggest a 1 Minute interval so you can configure your instances uptime with a granularity of 1 minute.\n\nFor each instance there is an uptime schedule, which may be modified by the trackbone tag. \nPer default an instance uptime is defined as 24/7 up. With the content of the tag you may \nnow take influence on the uptime schedule.  \n\nExample:\n```\n@1+12:30-16:00|@2+17:00-17:05|Mo#1|Tu#1#2|We#2\n```\nThe tag consists of an arbitrary number of commands, which are separated by a pipe symbol \"|\"  \nEach command may be one of the following:\n- schedule command\n- uptime definition\n\n### Uptime definition\nAn uptime definition first starts with an identifier after an @ followed by one or more time \ndefinitions. The identifier my consist of of upper and lowercase chars, numbers and underscores. \nEach time definition consists of a marker and a time. The marker may be + signaling\na start command or - signaling a stop command.\n\nSo the definition\n```\n@9_5_lunch+09:00-12:00+13:00-17:00\n```\nWill be available in the tag by the identifier **9_5_lunch** and signaling an uptime start at\n9am and ending at 5pm with a downtime from 12pm to 1pm.  \n\n### Schedule definition\nA schedule definition starts with a weekday identifier (Mo, Tu, We, Th, Fr, Sa, Su) and \nmultiple associated uptime definitions by \n\\# + their identifier.\nSo let's take the previously defined **9_5_lunch** uptime definition and associate it with monday to friday.\n```\nMo#9_5_lunch|Tue#9_5_lunch|We#9_5_lunch|Th#9_5_lunch|Fr#9_5_lunch|\n\n```\nThis will order trackbone to launch the instance based on the 9_5_lunch schedule each day.\nAs you can see, those definitions can get quite long, so keep the uptime identifiers short.\n\n### Example\nSo lets take the example from above:\n```\n@1+12:30-16:00|@2+17:00|@3-09:00|Mo#1#3|Fr#2\n```\nIt defines three uptime definitions:  \n1: Start the machine at 12:30 and stop it at 16:00\n2: Start the machine at 17:00\n3: Stop the machine at 09:00\n\nTwo days are associated with uptime definitions:  \nMonday is associated with uptime 1 and 3.  \nFriday is associated with uptime 2  \n\nThis means:\nOn Monday morning at 09:00 stop the machine. Start it again at 12:30 and stop it at 16:00. \nOn Friday start it at 17:00.\n\n### How does it work?\nFor each instance available, trackbone creates a 24/7 default up schedule. The uptime and \nschedule definitions are mapped upon this and therefore the correct uptime schedule is created.\nThe current state is evaluated and compared with the instance state. If the instance state doesn't\nmatch the determined state, it is stopped or started. Be careful not to trigger too many instances\nat once, so you don't hit the AWS API rate limit.  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fventx%2Ftrackbone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fventx%2Ftrackbone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fventx%2Ftrackbone/lists"}