# Plugin Help: Basic plugin to run a command in the background?

**URL:** <https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [May 29, 2018, 8:36pm UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047 "2018-05-29T20:36:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmstrat](https://avatars.discourse-cdn.com/v4/letter/f/f1d935/32.png) [@fmstrat](https://forums.plex.tv/u/fmstrat)\
**Post date:** [May 29, 2018, 8:36pm UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047/1 "2018-05-29T20:36:35Z")

</div>

Hi all. I want to run a command in the background for debug every 5 minutes. Is there a quick easy plugin template that would help me do this? I just want to pull some info from the DB using sqlite and push it to a file so I can track changes to the DB (I’m debugging a caching issue in another app). Thanks!

---

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [May 29, 2018, 8:50pm UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047/2 "2018-05-29T20:50:58Z")

</div>

Nope…

Use native OS tools for that, like `cron` if on Linux or Mac, and `Task Scheduler` if on Windows

---

<div class="post-metadata">

**Author:** ![fmstrat](https://avatars.discourse-cdn.com/v4/letter/f/f1d935/32.png) [@fmstrat](https://forums.plex.tv/u/fmstrat)\
**Post date:** [May 29, 2018, 9:06pm UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047/3 "2018-05-29T21:06:49Z")

</div>

Hrm, i need it in the plug-in unfortunately. Trying to see if a plug-in can monitor the DB changed that aren’t seen on the filesystem due to what I think is WAL caching.

---

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [May 29, 2018, 9:56pm UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047/4 "2018-05-29T21:56:51Z")

</div>

Then checkout my EPG-DK plugin, that contains a scheduler

[github.com/ukdtom/epg-dk.bundle](https://github.com/ukdtom/epg-dk.bundle/blob/master/Contents/Code/ __init__.py#L328 "https://github.com/ukdtom/epg-dk.bundle")

Note that you need to run the bundle as a [daemon](https://github.com/ukdtom/epg-dk.bundle/blob/master/Contents/Info.plist#L15 "daemon")

---

<div class="post-metadata">

**Author:** ![fmstrat](https://avatars.discourse-cdn.com/v4/letter/f/f1d935/32.png) [@fmstrat](https://forums.plex.tv/u/fmstrat)\
**Post date:** [May 30, 2018, 12:17am UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047/5 "2018-05-30T00:17:07Z")

</div>

> @dane22 said:  
> Then checkout my EPG-DK plugin, that contains a scheduler
> 
> [github.com/ukdtom/epg-dk.bundle](https://github.com/ukdtom/epg-dk.bundle/blob/master/Contents/Code/ __init__.py#L328 "https://github.com/ukdtom/epg-dk.bundle")
> 
> Note that you need to run the bundle as a [daemon](https://github.com/ukdtom/epg-dk.bundle/blob/master/Contents/Info.plist#L15 "daemon")

Awesome. Thank you! For reference, is there a simple Hello World Plug-in out there that maybe writes to a log file or something like that when hitting a URL on the Plex server? Just trying g to get my bearings. Thanks again.

---

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [May 30, 2018, 8:09am UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047/6 "2018-05-30T08:09:59Z")

</div>

> @fmstrat said:  
> Awesome. Thank you! For reference, is there a simple Hello World Plug-in out there that maybe writes to a log file or something like that when hitting a URL on the Plex server? Just trying g to get my bearings. Thanks again.

Not that I know off, sorry

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 8, 2020, 8:08pm UTC](https://forums.plex.tv/t/plugin-help-basic-plugin-to-run-a-command-in-the-background/237047/7 "2020-01-08T20:08:21Z")

</div>


