watch

run a python script everytime the computer wakes up from hibernation

一个人想着一个人 提交于 2019-12-03 17:16:04
i wrote a small script on python that calls a command line from the console in order to hibernate a linux machine (or shut itself down in case one word is changed) and then wake up after some time. The command is called again again and again through the watch command. import os import time os.system("watch -n 20 sudo rtcwake -u -s 10 -m mem") So the rtcwake command is called again 20 seconds after the pc has wokn up again. I would like another script to be run every time the computer wakes up. I already have this other script, it is a countdown. I want to do this in order to show the user how

Node.js listen to MongoDB change

孤者浪人 提交于 2019-12-03 15:41:36
Is there a way for Node.js to listen to a change in a particular data in a collection of MongoDB, and fire an event if a change happens? I believe you are looking for a database trigger . Unfortunately, MongoDB has no support for them yet, so I don't think you can listen for changes directly from the database. You'll need to setup some sort of notification system (e.g. pub/sub) that alerts interested parties when a collection has changed. Well, this is an old question, but I was struggling with the same thing. I found a number of tidbits that helped me put together a solution, and I've

Restart Heroku local on file change?

点点圈 提交于 2019-12-03 15:20:11
问题 It seems the local server started with "heroku local web" does not watch for file changes and restart itself. How can I make it do this? 回答1: The easiest way to do this is to run nodemon with heroku local as the executable - i.e. nodemon --exec "heroku local" . However, heroku local exits with a non-zero exit code for the default nodemon shutdown signal (SIGUSR2), so you need to add an additional flag to nodemon to set the interrupt signal to SIGTERM. nodemon --exec "heroku local" --signal

Grunt with Compass and Watch compiles slow

这一生的挚爱 提交于 2019-12-03 12:28:32
Grunt takes a quite long to compile the css file, I am not sure if this is normal but regular compass watch takes around 5 seconds. So the question is if there is any way to speed up the compilation time with Grunt or is it better to just stick with compass watch? Running "compass:dist" (compass) task ♀unchanged images/sprite-sf580a96666.png overwrite stylesheets/app.css (3.263s) unchanged images/sprite-sf580a96666.png overwrite stylesheets/app_fr.css (3.289s) Compilation took 11.116s Running "watch" task Completed in 13.974s at Wed Dec 18 2013 13:53:05 GMT-0500 (Eastern Standard Time- Waiting

Restart Heroku local on file change?

喜你入骨 提交于 2019-12-03 10:23:37
It seems the local server started with "heroku local web" does not watch for file changes and restart itself. How can I make it do this? The easiest way to do this is to run nodemon with heroku local as the executable - i.e. nodemon --exec "heroku local" . However, heroku local exits with a non-zero exit code for the default nodemon shutdown signal (SIGUSR2), so you need to add an additional flag to nodemon to set the interrupt signal to SIGTERM. nodemon --exec "heroku local" --signal SIGTERM (tested with heroku-cli@6.14.31-33a2d0a, nodemon@1.12.1, node@8.5.0) heroku local just uses node

Angularjs watch service object

↘锁芯ラ 提交于 2019-12-03 09:22:24
问题 Why can't I watch a object in a service. Ive got a simple variable working, but a object wont work. http://plnkr.co/edit/S4b2g3baS7dwQt3t8XEK?p=preview var app = angular.module('plunker', []); app.service('test', ['$http', '$rootScope', function ($http, $rootScope) { var data = 0; var obj = { "data": 0 }; this.add = function(){ obj.data += 1; console.log('data:', obj); }; this.getData = function() { return obj; }; }]); app.controller('TestController', ['$scope', '$rootScope', '$filter', 'test

grunt watch task block the command line

余生颓废 提交于 2019-12-03 05:51:36
I'm new to grunt, still learning, so I came up to a very strange problem. When I run "watch" task, my command line becomes blocked, so basically I cant do anything on it. Bare in mind that the task is completed with success. This is my command line output: C:\server\css-test>grunt w Running "watch" task Waiting...OK >> File "compass-examples-master\02\sass\screen.scss" changed. Running "compass" (compass) task unchanged compass-examples-master/02/sass/ie.scss unchanged compass-examples-master/02/sass/print.scss overwrite compass-examples-master/02/stylesheets/new/sass/screen.css Running "watch

Java: Watching a directory to move large files

让人想犯罪 __ 提交于 2019-12-03 02:42:20
问题 I have been writing a program that watches a directory and when files are created in it, it changes the name and moves them to a new directory. In my first implementation I used Java's Watch Service API which worked fine when I was testing 1kb files. The problem that came up is that in reality the files getting created are anywhere from 50-300mb. When this happened the watcher API would find the file right away but could not move it because it was still being written. I tried putting the

grunt-contrib-watch causing Maximum call stack size exceeded

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I execute the clean task (grunt clean), everything works as expected but when I run the watch task (grunt test), I get the following error: util.js:35 var str = String(f).replace(formatRegExp, function(x) { ^ RangeError: Maximum call stack size exceeded Here's my gruntfile module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON('package.json') clean: ['tmpDir/'] watch: options: spawn: false src: tasks: ['clean'] files: [ src: 'client/assets/strings/en/str.coffee' ] # plugins grunt.loadNpmTasks('grunt-contrib-clean') grunt

Grunt watch Running “watch” task Waiting

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a problem with grunt-watch. When I use "grunt" in terminal outputs "Running "watch" task Waiting..." krp-arina@krparina-Lenovo-G555:~/server$ grunt Running "watch" task Waiting... krp-arina@krparina-Lenovo-G555:~/server$ grunt -v Initializing Command-line options: --verbose Reading "Gruntfile.js" Gruntfile...OK Registering Gruntfile tasks. Registering "grunt-contrib-less" local Npm module tasks. Reading /home/krp-arina/server/node_modules/grunt-contrib-less/package.json...OK Parsing /home/krp-arina/server/node_modules/grunt-contrib