Empty line under unix environment
Created by: datatravelgit
Hi team,
Issue
Under Unix, the user crontab leaves an empty line after each batch of jobs that are saved. Under Windows, a crontab destination file leaves an empty line at the end only .
How to reproduce this:
- When using Crontab in a Windows OS (To test the output) 1.1) In this environment, if I start with a new empty file and insert a new job, the destination file contains an empty line at the end of the file:
Code:
crontab = CronTab()
...
crontab.write(destination),
Destination File (see 1 empty line after crontab job):
SHELL=/bin/bash
0 9 * * 2,3,4,5,6 to_run.sh test 1 env=_ENV_ running_date=_JOB_DATE_
1.2) If I open the same file to add another line in the crontab Code:
crontab = CronTab(tabfile=destination)
...
crontab.write(destination),
Destination File (see 1 empty line after last crontab job):
SHELL=/bin/bash
0 9 * * 2,3,4,5,6 to_run.sh test 1 env=_ENV_ running_date=_JOB_DATE_
0 9 * * 2,3,4,5,6 to_run.sh test 1 env=_ENV_ running_date=_JOB_DATE_
- When using Crontab in a Unix OS (Where the production code runs)
2.1) In this environment, if I start with a new empty user crontab, the destination contains an empty line at the end of the file: Code:
crontab = CronTab()
...
crontab.write(destination),
Destination (see 1 empty line after crontab job):
SHELL=/bin/bash
0 9 * * 2,3,4,5,6 to_run.sh test 1 env=_ENV_ running_date=_JOB_DATE_
2.2) If I open the user crontab to add another line: Code:
crontab = CronTab(user=True)
...
crontab.write(user=True),
The destination contains blank spaces after each line:
SHELL=/bin/bash
0 9 * * 2,3,4,5,6 to_run.sh test 1 env=_ENV_ running_date=_JOB_DATE_
0 9 * * 2,3,4,5,6 to_run.sh test 1 env=_ENV_ running_date=_JOB_DATE_
Versions used
- Python 3.6.4 (Under Unix and Windows)
- python_crontab 2.2.8 (Under Unix and Windows)
- Windows 7 Enterprice
- Unix: Red hat enterprise linux