Strictly speaking you can’t do this entirely inside WP. WP can only do an activity when someone accesses a page. It can’t spontaneously do an action at an interval, it can only react to a page access. That being said, WP has a wp_cron() function and wp_schedule_event() where you can schedule a hook to run. But I don’t think it supports @30-sec intervals. Plus, if no one is hitting the site, it won’t run until someone does (later).
So you would have to set up something external to your site to trigger the action. If you have access to your Unix/Linux host, you could create a cron entry that would tell the server to do something every 30 seconds like run a script or hit a URL on your site to trigger it do something. You could set up a special page on your site to trigger the action you want, then have Unix cron call curl or wget on that URL every 30 seconds.