系统:ubuntu 16
我在服务器上有一个工作节点应用程序。在package.json中有脚本,其中包含要执行的选项:
forever start ./bin/www
需要什么:
现在我可以通过转到app目录并输入以下命令永远开始:
forever start /home/myapp/bin/www
但是无法控制环境。
此外,当我从根目录尝试此操作时 - 它失败了:
var shuffleme = (function($) {
'use strict';
var $grid = $('#grid'), //locate what we want to sort
$filterOptions = $('.portfolio-sorting li'), //locate the filter categories
$sizer = $grid.find('.shuffle_sizer'), //sizer stores the size of the items
init = function() {
// None of these need to be executed synchronously
setTimeout(function() {
listen();
setupFilters();
}, 100);
// instantiate the plugin
$grid.shuffle({
itemSelector: '[class*="col-"]',
sizer: $sizer
});
},
// Set up button clicks
setupFilters = function() {
var $btns = $filterOptions.children();
$btns.on('click', function(e) {
e.preventDefault();
var $this = $(this),
isActive = $this.hasClass('active'),
group = isActive ? 'all' : $this.data('group');
// Hide current label, show current label in title
if (!isActive) {
$('.portfolio-sorting li a').removeClass('active');
}
$this.toggleClass('active');
// Filter elements
$grid.shuffle('shuffle', group);
});
$btns = null;
},
// Re layout shuffle when images load. This is only needed
// below 768 pixels because the .picture-item height is auto and therefore
// the height of the picture-item is dependent on the image
// I recommend using imagesloaded to determine when an image is loaded
// but that doesn't support IE7
listen = function() {
var debouncedLayout = $.throttle(300, function() {
$grid.shuffle('update');
});
// Get all images inside shuffle
$grid.find('img').each(function() {
var proxyImage;
// Image already loaded
if (this.complete && this.naturalWidth !== undefined) {
return;
}
// If none of the checks above matched, simulate loading on detached element.
proxyImage = new Image();
$(proxyImage).on('load', function() {
$(this).off('load');
debouncedLayout();
});
proxyImage.src = this.src;
});
// Because this method doesn't seem to be perfect.
setTimeout(function() {
debouncedLayout();
}, 500);
};
return {
init: init
};
}(jQuery));
$(document).ready(function() {
shuffleme.init(); //filter portfolio
});
如何从根目录和使用npm脚本永远启动? 我假设初始脚本应该放在
中的/etc/rc.local